Welcome! Log In Create A New Profile

Advanced

Can I use upstreaming based on a URI regex?

Can I use upstreaming based on a URI regex?
July 09, 2014 04:28AM
Hello,

I have an issue with our nginx conf.

How can I upstream to different machine clusters based on a URI.

I have tried the following within the server block,

if ($uri ~ ^/.*oo=oo*/) {upstream //bla}
if ($uri ~ ^/.*/) {upstream //blabla} (all the rest)

what am i doing wrong?

Can I use if for upstreaming?

Thanks,

Meir
Re: Can I use upstreaming based on a URI regex?
July 10, 2014 05:10AM
Help anybody?

Thanks
Re: Can I use upstreaming based on a URI regex?
July 10, 2014 05:48AM
This should work, but without a complete config and the errors you get it's a guessing game why it ain't working.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Can I use upstreaming based on a URI regex?
July 10, 2014 06:20AM
Thanks,

The upstream works when out of the "if", but even with an "if" that looks like this

if ($uri ~ ^/.*) { upstream //booboo} it doesnt work. this regex should catch everything, just like putting outside of the "if", upstream //booboo, right?

The nginx gives 404 error.

Can you help?

Thanks
Re: Can I use upstreaming based on a URI regex?
July 13, 2014 02:08AM
Anybody?
Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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