2009/1/19 vince <[email protected]>: > > i am trying to get mod_rewrite work with mod_wsgi. however the > rewrite seems to work according the log but then WSGIScriptAlias did > catch it. > > when i have this config in apache > > WSGISocketPrefix /private/var/run/wsgi > WSGIDaemonProcess devel user=www group=www home=/var/www/devel/ > inactivity-timeout=60 > <VirtualHost *:80> > RewriteEngine on > RewriteLogLevel 9 > RewriteLog "/var/log/apache2/rewrite.log" > RewriteRule ^/test/(.*) /test/ok/$1 [E=PATH_INFO:ok] > WSGIScriptAlias /test /var/www/devel/testwsgi.py > WSGIProcessGroup devel > </VirtualHost> > > rewrite log shows: > (2) init rewrite engine with requested uri /test/ > (3) applying pattern '^/test/(.*)' to uri '/test/' > (2) rewrite '/test/' -> '/test/ok/' > (5) setting env variable 'PATH_INFO' to 'ok' > (2) local path result: /test/ok/ > (2) prefixed with document_root to /usr/htdocs/test/ok/ > (1) go-ahead with /usr/htdocs/test/ok/ [OK] > > WSGIScriptAlias didn't match the /test and apache just serve the html > files. if i remove the rewrite the wsgi works. > > i then tried > > WSGISocketPrefix /private/var/run/wsgi > WSGIDaemonProcess devel user=www group=www home=/var/www/devel/ > inactivity-timeout=60 > <VirtualHost *:80> > RewriteEngine on > RewriteLogLevel 9 > RewriteLog "/var/log/apache2/rewrite.log" > #RewriteRule ^/test/(.*) /test/ok/$1 [E=PATH_INFO:ok] > RewriteRule . - [E=PATH_INFO:ok] > > WSGIScriptAlias /test /var/www/devel/testwsgi.py > WSGIProcessGroup devel > </VirtualHost> > > http://localhost/test > > rewrite.log > (2) init rewrite engine with requested uri / > (3) applying pattern '.' to uri '/' > (5) setting env variable 'PATH_INFO' to '/ok' > (1) pass through / > > this time WSGI works but then PATH_INFO still remain "/" in the WSGI > application via enviorn["PATH_INFO'] > > > actually what i want to do is just a > WSGIScriptAlias /test /var/www/devel/testwsgi.py > and want the PATH_INFO remain unchanged in testwsgi.py. that is still > "/test" > > can anyone show me some lights?
I haven't groked what you are trying to do exactly yet, but be aware that PATH_INFO is a special CGI variable that is pushed into WSGI environment and any value you set for it will be overridden. Do you perhaps just need to choose a different variable name, or are you intentionally somehow trying to override the PATH_INFO value passed as part of WSGI environment. If the latter, if you just let mod_rewrite do its job properly with rewriting URLs, SCRIPT_NAME/PATH_INFO should be changed automatically based on what URL rewriting mod_rewrite is doing. Can you perhaps explain a bit better what it is you are trying to do if it isn't going to be obvious when I reread this all again a few times. Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---
