URL encoded URLs and regex locations

Igor Sysoev is at rambler-co.ru
Thu May 7 08:47:32 MSD 2009

On Tue, May 05, 2009 at 12:14:23PM -0700, Joe Williams wrote:

> I found this post 
> (http://thread.gmane.org/gmane.comp.web.nginx.english/9526) regarding 
> URL encoding, example from the email (e.g. /foo/bar%2Fbaz -> 
> /foo/bar/baz). I have a regex location (location ~ /my_url*) for a 
> proxy_pass, adding the '/' to the end of the upstream server gives me an 
> error:
> >"proxy_pass" may not have URI part in location given by regular 
> >expression, or inside named location, or inside the "if" statement, or 
> >inside the "limit_except" block
> Is there any way around this, I need regex in my location and URL 
> encoded URLs to work properly.

You should omit the "/" (URI part):

     location ~ ^/my_url {
         proxy_pass  http://backend;

Then a client request URI will bed sent to the backend unchanged.

Igor Sysoev

More information about the nginx mailing list