Opened 8 years ago

Closed 8 years ago

#963 closed defect (duplicate)

Double escaping of URI variable in IF statement

Reported by: chuguyster@… Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.8.x
Keywords: Cc:
uname -a: Linux 3.14.48-33.39.amzn1.x86_64 #1 SMP Tue Jul 14 23:43:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.8.1
built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
built with OpenSSL 1.0.1k-fips 8 Jan 2015
TLS SNI support enabled

Description

Upstream configuration:

server {
    listen       80;
    server_name  en.tests.local;

    location / {
        default_type  text/plain;

        return 200 'Url: $request_uri';
    }
}

Proxy configuration:

server {
    listen       80;
    server_name  ru.tests.local ;

    set $rps_uri $request_uri;

    location / {

        proxy_pass         $scheme://127.0.0.1$rps_uri;
        proxy_set_header Host en.tests.local;

        if ($request_uri ~ ^/ru-ru/(.*)$) {set $rps_uri "/en-us/$1";}
    }
}

Curl:

curl http://localhost/ru-ru/%D1%82%D0%B5%D1%81%D1%82 -H "Host: ru.tests.local"

Expected value of $request_uri on upstream server:

/en-us/%D1%82%D0%B5%D1%81%D1%82

Actual result:

/en-us/%25D1%2582%25D0%25B5%25D1%2581%25D1%2582

Change History (1)

comment:1 by Maxim Dounin, 8 years ago

Resolution: duplicate
Status: newclosed

Looks like duplicate of #348.

Note: See TracTickets for help on using tickets.