rewrite / proxy_pass different bahaviour in 1.0 and 1.2

Maxim Dounin mdounin at mdounin.ru
Fri Sep 28 17:58:32 UTC 2012


Hello!

On Fri, Sep 28, 2012 at 11:36:49AM -0400, alexey.radkov wrote:

> Hi guys.
> 
> 
> Is the following result of a bug fix in proxy module in 1.2 series?
> 
> Imagine following config (sorry, i do not know how to format it here):

[...]

>         location /test.html {
>             rewrite ^ /Internal_test last;
>         }
> 
>         location /Internal_test {
>             internal;
>             proxy_pass http://$arg_a;
>         }
>     }

[...]

> and following request:
> 
> curl 'http://localhost:8010/test.html?a=ubackend'

[...]

> So the difference is that in 1.0 original URI is not rewritten in HTTP GET
> header when proxied after rewrite, but in 1.2 it is rewritten to
> /Internal_test thus giving result 404 Not Found.
> 
> 
> Do I understand this right that 1.0 behaviour was not correct and just fixed
> in 1.2?

Yes.  This was fixed 1.1.12:

    *) Bugfix: a "proxy_pass" directive without URI part always used
       original request URI if variables were used.

> To achieve 1.0 behaviour in 1.2 i can add only 2 lines of code from 1.0.

You may also use

   proxy_pass http://$arg_a$request_uri;

to get the old behaviour.

[...]

-- 
Maxim Dounin
http://nginx.com/support.html



Подробная информация о списке рассылки nginx-ru