How to grab a value from a request

Francis Daly francis at daoine.org
Wed Oct 4 07:16:18 UTC 2017


On Tue, Oct 03, 2017 at 11:29:44AM -0400, halfpastjohn wrote:

Hi there,

> I'm sorry i don't quite follow. How is your example using the map directive?

It isn't.

If you want to pick pieces from the request, you can use "map".

However, what you have described so far as your use case does not need
to pick pieces from the request.

> 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

If you can hardcode the location bit, you can hardcode exactly the same
thing in the proxy_pass bit, no?

> location /users/v2/  {
>     proxy_pass http://app.domain.com/api/{{users}}/v2;

Make that be

     proxy_pass http://app.domain.com/api/users/v2/;

and it should Just Work, no?

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list