Welcome! Log In Create A New Profile

Advanced

nginx rewrite removes duplicate slashes when I don't want it to

Posted by Kura 
nginx rewrite removes duplicate slashes when I don't want it to
June 19, 2012 09:57AM
Hey,

I have an nginx server with a location based proxy_pass configured:

location /taz {
rewrite /taz/(.*) /$1 break;
proxy_pass http://localhost:8080;
}

It is used for click tracking before redirecting, I have found that when the request is proxied back to the system running on port 8080 that the request is being modified by nginx, more than I've configured.

If I go to http://server/taz/12345/http://google.com

It actually requests: http://localhost:8080/12345/http:/google.com

As you'll see the second http:// call is missing a slash.

I know it's bad to pass the second http:// through but they are legitimate characters as far as I'm aware, and it's fast for me to grab everything after the first set of / / and just set a Location header for the browser to redirect to it.

Anyone have any ideas?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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