How to grab a value from a request

Francis Daly francis at
Mon Oct 2 23:43:24 UTC 2017

On Mon, Oct 02, 2017 at 06:23:37PM -0400, halfpastjohn wrote:

Hi there,

> 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?

In general, you can use map ( with named regex captures.

In this specific case:

> Request:[resource]/v2/
> Upstream:[resource]/v2/

  location / { proxy_pass; }

might do exactly what you want.

Francis Daly        francis at

More information about the nginx mailing list