Welcome! Log In Create A New Profile

Advanced

Rewrite undecoded URL

March 19, 2015 11:52AM
Hello. We are trying to use the nginx rewrite rule, without the application of URL decoding. The relevant portion of our test configuration is:

location ~ ^/p/stratus.* {

include conf.d/hosts.conf;

proxy_pass http://localhost:8080;
proxy_set_header Host $host;

# strip leading /p (note that 'break' stops processing ngx_http_rewrite_module directives, including 'set')
rewrite ^/p(.*)$ $scheme://$server_addr/?redirect_to=$scheme://$host/$1 break;
}

location / {
return 200 'Twas Brillig...';
}

The rewite behaves properly in stripping off the /p but writes the decoded url rather than leaving it untouched. We have enocded slashes (/) -- %2F -- within the URI. Not as parameters but in the body of the url. Nginx is decoding these and we need to pass the url upstream intact but with the /p stripped.

Any help would be appreciated, as we're out of ideas.
Subject Author Posted

Rewrite undecoded URL

youngde811 March 19, 2015 11:52AM

Re: Rewrite undecoded URL

Francis Daly March 23, 2015 07:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
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