How to grab a value from a request
Reinis Rozitis
r at roze.lv
Tue Oct 3 16:10:17 UTC 2017
> 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;
> }
Well in general it's something like:
location ~ ^/(.*)/v2/ {
proxy_pass http://app.domain.com/api/$1/v2;
}
Depending on if there are other url parts and/or variables the other way
would be just to use rewrite within matching location block (or just globaly
if every request is proxied). For example:
location /users/v2/ {
rewrite ^/(.*)/v2/ /api/$1/v2 break;
proxy_pass http://app.domain.com;
}
rr
More information about the nginx
mailing list