From e741fd1d0affaa05859561b5a3219ee055c10c07 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sun, 20 Dec 2009 16:03:12 -0500 Subject: [PATCH] Fix the unauthenticated web interface. Separate the separate components of the web app by the authenticated webapp class at /auth and the unauthenticated app at /unauth. These are purely internal URLs, but used to allow a single CherryPy instance to serve both the authenticated and unauthenticated website. svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2728 --- code/main.fcgi | 26 ++++++++++++++++-------- files/etc/apache2/sites-available/default.mako | 2 +- files/etc/apache2/sites-available/ssl.mako | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/code/main.fcgi b/code/main.fcgi index fa2681a..b20cfeb 100755 --- a/code/main.fcgi +++ b/code/main.fcgi @@ -30,17 +30,25 @@ if __name__ == "__main__": dev = True else: conf_file = os.path.join(base_dir, 'main.conf') - app = cherrypy.tree.mount(InvirtWeb(), - '/', - {'/': {'tools.staticdir.root': static_dir, - 'tools.invirtwebstate.on': True}, - '/static': {'tools.staticdir.on': True, - 'tools.staticdir.dir': static_dir} - }) - app.merge(conf_file) + + app_config = { + '/': { + 'tools.invirtwebstate.on': True, + }, + '/static': { + 'tools.staticdir.root': static_dir, + 'tools.staticdir.on': True, + 'tools.staticdir.dir': static_dir, + } + } + + authApp = cherrypy.tree.mount(InvirtWeb(), + '/auth', + app_config) + authApp.merge(conf_file) unauthApp = cherrypy.tree.mount(InvirtUnauthWeb(), '/unauth', - {'/': {'tools.invirtwebstate.on': True}}) + app_config) unauthApp.merge(conf_file) cherrypy.config.update(conf_file) diff --git a/files/etc/apache2/sites-available/default.mako b/files/etc/apache2/sites-available/default.mako index 8ac6fb7..7ec0903 100644 --- a/files/etc/apache2/sites-available/default.mako +++ b/files/etc/apache2/sites-available/default.mako @@ -23,7 +23,7 @@ NameVirtualHost *:80 RewriteRule ^/trac(.*) ${tracuri}$1 [R,L] RewriteRule ^/invirt - [L] RewriteRule ^/kill.cgi - [L] - RewriteRule ^/(.*) /var/www/invirt-web/main.fcgi/$1 [L] + RewriteRule ^/(.*) /var/www/invirt-web/main.fcgi/unauth/$1 [L] ErrorLog /var/log/apache2/error.log diff --git a/files/etc/apache2/sites-available/ssl.mako b/files/etc/apache2/sites-available/ssl.mako index be558e0..009b412 100644 --- a/files/etc/apache2/sites-available/ssl.mako +++ b/files/etc/apache2/sites-available/ssl.mako @@ -26,7 +26,7 @@ ${caller.body()} RewriteRule ^/admin/static(.*) /static/$1 [L] RewriteRule ^/trac(.*) ${tracuri}$1 [R,L] RewriteRule ^/kill.cgi - [L] - RewriteRule ^/(.*) /var/www/invirt-web/main.fcgi/$1 [L] + RewriteRule ^/(.*) /var/www/invirt-web/main.fcgi/auth/$1 [L] RewriteLog /var/log/apache2/rewrite.log RewriteLogLevel 0 -- 1.7.9.5