Forum: NGINX URL encoded URLs and regex locations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Da66a56107b535386a9daf538a3b1d7d?d=identicon&s=25 Joe Williams (zeusfaber)
on 2009-05-05 21:23
(Received via mailing list)
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.

Thanks.
-Joe
Da66a56107b535386a9daf538a3b1d7d?d=identicon&s=25 Joe Williams (zeusfaber)
on 2009-05-06 22:39
(Received via mailing list)
Anyone have any ideas/suggestions? Not possible?

-Joe
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-05-07 06:58
(Received via mailing list)
On Tue, May 05, 2009 at 12:14:23PM -0700, Joe Williams wrote:

>
> 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.
This topic is locked and can not be replied to.