Unable to use a GET url-param

Francis Daly francis at daoine.org
Sat Apr 15 15:20:22 UTC 2017

On Sat, Apr 15, 2017 at 02:47:26PM +0530, Ajay Garg wrote:

Hi there,

> If there is no forwarded-port in listening state (port 5000 in this case)
> for the upstream-server, the request suitably returns a 502 error. More
> importantly, the $arg_upstream_protocol does seem to be parsed properly ::

Why do you have $arg_upstream_protocol? What is its purpose?

After you answer that, consider: why do you not also have

If the port to connect to, and the protocol to connect with, are
conceptually analogous, they should probably be handled in the same way.

(Set them both in maps.)

> So, the GET-param is being parsed fine (as evident from case a), seems I
> need to do some url-rewritings while the requests move to and from between
> nginx and upstream-server, right?

One request gets one response. If the response is a http 301, the next
request is a whole new request that should be considered separately.

If at all possible, do not design things so that you need to edit the
upstream response body before sending it to the client.

So: what is the output of "curl -v" on the first request?

What do you want the output to be, in your design?

Francis Daly        francis at daoine.org

More information about the nginx mailing list