After reading https://github.com/unbit/uwsgi/pull/19 I understood that using uwsgi_modifier1 30;
is deprecated.
So this is how I solved the problem.
First of all I removed SCRIPT_NAME handling in nginx by removing these two lines:
uwsgi_param SCRIPT_NAME /foo;
uwsgi_modifier1 30;
The resulting nginx configuration looked like this:
debian:~# cat /etc/nginx/sites-enabled/mybox
server {
listen 8080;
root /www;
index index.html index.htm;
server_name mybox;
location /foo {
uwsgi_pass unix:/tmp/uwsgi.sock;
include uwsgi_params;
}
}
Then I restarted nginx and did SCRIPT_NAME handling in uwsgi using the --mount
and --manage-script-name
options like this.
service nginx restart
uwsgi -s /tmp/uwsgi.sock -w app --chown-socket=www-data:www-data --manage-script-name --mount=/foo=/www/app.py
Now, I get the expected output.
debian:~# curl http://mybox:8080/foo/bar
PATH_INFO: '/bar'
SCRIPT_NAME: '/foo'
REQUEST_URL: '/foo/bar'