Re: basic rewrite question

2017-10-18 Thread halfpastjohn
rather, $request_uri Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276946,276949#msg-276949 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

Re: basic rewrite question

2017-10-18 Thread halfpastjohn
Also - our standardization is not the greatest, so I actually want to rewrite the entire URI, which is why I have ^/(.*) as the regex. However I don't think the $1 in the replacement string will still apply to the original URI. Would this work? location ~* /v1/device/(.*)/ { rewrite $uri /api/v1.

basic rewrite question

2017-10-18 Thread halfpastjohn
I'm trying to setup rewrites so I can automate this more efficiently. Some of my locations require a rewrite and some do not. I currently have it hardcoded into the proxy_pass: location ~* /v1/device/(.*)/ { proxy_pass http://api.domain.com/api/v1.0/download/$1; } Would this accomplish the

duplicate upstream server marked as down

2017-10-03 Thread halfpastjohn
Can i have two, identical, server hostnames in an upstream, with one of them marked as "down"? Like this: resolver 10.0.0.8; upstream backend { server backend.example.com down resolve; server backend.example.com/api/v2/; } The reason being is that i need to route to the second one (with

Re: How to grab a value from a request

2017-10-03 Thread halfpastjohn
Would this work? location ~ ^/users/v2/ { proxy_pass http://app.domain.com/api/$1/v2; } Would $1 resolve as users or does it need to be inside ()? Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276652,276664#msg-276664 ___ nginx mailing li

Re: How to grab a value from a request

2017-10-03 Thread halfpastjohn
I'm sorry i don't quite follow. How is your example using the map directive? Just for clarity, here is what I'm trying to do. location /[resource]/v2/ { proxy_pass http://app.domain.com/api/[resource]/v2; } In fact, the location bit will be hardcoded with the actual resource, I just need the

How to grab a value from a request

2017-10-02 Thread halfpastjohn
I'm setting up nginx as a proxy router for various APIs. How can I take a specific value form the incoming request and dynamically populate it into the upstream? Request: https://api.domain.com/[resource]/v2/ Upstream: https://app.domain.com/api/[resource]/v2/ I this case, I want to take [resourc