No subject

m irya xmirya at gmail.com
Tue May 22 14:52:33 UTC 2012


Hi,

I'm trying to make nginx mod_zip work with internal http requests
(instead of local files), however somehow the "?" sign in the URL is
being urlencoded, breaking everything. Nginx serves as a proxy for
Apache, and the configuration is straightforward:

location / {
            proxy_pass         http://127.0.0.1:8080;
            proxy_redirect     off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            ...
}

location /store/ {
            alias /;
            internal;
}

Providing the "command" to mod_zip like (for /store/some/file.txt):

da595dd9 23272 %2Fstore%2Fsome%2Ffile.txt some-file.txt

works like expected - i've got a ZIP archive with some-file.txt
inside. However, if i'm trying (for
/the/url/to/download?file=file.txt&another=param):

da595dd9 23272 %2Fthe%2Furl%2Fto%2Fdownload%3Ffile%3Dfile.txt%26another%3Dparam
some-file.txt

i've got an empty archive. Exploring the nginx error log i've found
the next statement:

2012/05/22 17:30:45 [error] 5448#0: *20 mod_zip: a subrequest returned
404, aborting... while reading response header from upstream, client:
127.0.0.1, server: server.name, request: "GET /the/original/url
HTTP/1.1", subrequest:
"/the/url/to/download?file=file.txt&another=param", upstream:
"http://127.0.0.1:8080/the/url/to/download%3ffile=file.txt&another=param",
host: "server.name"

As you see, while "subrequest" is correct, in the "upstream" the
question mark was urlencoded for some reason (while "&" and "=" were
not), and the Apache logs confirm the request is incorrect (so
returning 404).

Is there any way to avoid such extra-encoding?

nginx-1.2.0/FreeBSD, mod_zip is the only compiled in module.



More information about the nginx mailing list