Welcome! Log In Create A New Profile

Advanced

Re: question mark transformed to %3f on internal redirects with Nginx 1.2.0

Maxim Dounin
May 02, 2012 12:22PM
Hello!

On Tue, May 01, 2012 at 04:45:52PM +0200, Dilyan Palauzov wrote:

> Hello,
>
> I have a rule
> server {
> ...
> index index.php /cgi-bin/wa?INDEX;
> }
>
> /cgi-bin/wa is forwarded to a thhpd server:
>
> location /cgi-bin {
> proxy_pass http://lists.aegee.org:8080;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_pass_request_headers on;
> }
>
> and it works with Nginx 1.1.15.

[...]

> and invoking the site, that redirects internally to
> /cgi-bin/wa?INDEX, I get an error message from thttpd:
>
> 404 Not Found
> The requested URL '/cgi-bin/wa%3fINDEX' was not found on this server.
>
> But, if I request directly /cgi-bin/wa?INDEX in the browser,
> everything works perfect.
>
> I think there is something in Nginx 1.2.0, that rewrites the
> question mark in %3f for internal redirects, that was not done in
> 1.0.15 and I would like to have the old behaviour back (or hints,
> how to solve the "cgi-bin/wa%3fINDEX not found" problem .)

In 1.0.15 this resulted in original request uri passed to
upstream server, and probably that's why it worked for you. The
'?' was never handled specially in index directive arguments (i.e.
it was always subject to escaping if passed to upstream server).

To actually request "/cgi-bin/wa?INDEX" (in both 1.2.0 and 1.0.15)
you may try something like this:

index index.php /index;

location = /index {
proxy_pass http://lists.aegee.org:8080/cgi-bin/wa?INDEX;
...
}

If you want previous behaviour, try something like this:

location /cgi-bin/ {
proxy_pass http://lists.aegee.org:8080$request_uri;
...
}

(note that this will also result in dynamic resolution of
"lists.aegee.org", so you either have to define upstream{} with
the name in question, or configure a resolver)

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

question mark transformed to %3f on internal redirects with Nginx 1.2.0

Dilyan Palauzov May 01, 2012 10:46AM

Re: question mark transformed to %3f on internal redirects with Nginx 1.2.0

Ashish S May 01, 2012 11:42AM

Re: question mark transformed to %3f on internal redirects with Nginx 1.2.0

Dilyan Palauzov May 01, 2012 03:24PM

Re: question mark transformed to %3f on internal redirects with Nginx 1.2.0

Maxim Dounin May 02, 2012 12:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 129
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready