<div dir="ltr"><div><div><div>Hi Francis.<br><br></div>I tried the curl method, and I happened to land on an interesting observation.<br><br></div>a)<br></div>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 ::<br><br>#####################################################<br><div><div><div><div>2017/04/15 09:08:56 [error] 16039#16039: *40 connect() failed (111: 
Connection refused) while connecting to upstream, client: 182.69.5.226, 
server: , request: "GET /?upstream_protocol=http HTTP/1.1", upstream: 
"<a href="http://127.0.0.1:5000/?upstream_protocol=http">http://127.0.0.1:5000/?upstream_protocol=http</a>", host: "1.2.3.4"<br>#####################################################<br><br>b)<br>However, if the forwarded port is in listening state, I get the usual 500 error ::<br><br>#####################################################<br>2017/04/15 09:08:21 [error] 16039#16039: *37 invalid URL prefix in "://<a href="http://127.0.0.1:5000">127.0.0.1:5000</a>", client: 182.69.5.226, server: , request: "GET /cgi-bin/webproc HTTP/1.1", host: "1.2.3.4", referrer: "<a href="https://1.2.3.4/?upstream_protocol=http">https://1.2.3.4/?upstream_protocol=http</a>"<br>#####################################################<br><br><br></div><div>Note that /cgi-bin/webproc is the default location for the upstream-server.<br></div><div>Also, to re-iterate, following is the proxy-pass directive ::<br><br>                        proxy_pass $arg_upstream_protocol://127.<wbr>0.0.1:$forwarded_port;<br><br></div><div><br></div><div>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?<br></div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 15, 2017 at 1:55 PM, Francis Daly <span dir="ltr"><<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Apr 14, 2017 at 06:42:22PM +0530, Ajay Garg wrote:<br>
<br>
Hi there,<br>
<span class=""><br>
> When I do the following call ::<br>
><br>
> <a href="https://username:password@1.2.3.4?upstream_protocol=http" rel="noreferrer" target="_blank">https://username:password@1.2.<wbr>3.4?upstream_protocol=http</a><br>
<br>
</span><span class="">> 2017/04/14 13:03:51 [error] 16039#16039: *1 invalid URL prefix in "://<br>
> <a href="http://127.0.0.1:5000" rel="noreferrer" target="_blank">127.0.0.1:5000</a>", client: 182.69.5.226, server: , request: "GET<br>
> /cgi-bin/webproc HTTP/1.1", host: "1.2.3.4", referrer: "<br>
> <a href="https://1.2.3.4/?upstream_protocol=http" rel="noreferrer" target="_blank">https://1.2.3.4/?upstream_<wbr>protocol=http</a>"<br>
<br>
</span>> What am I missing?<br>
<br>
The request in the log line is not the same as the first request provided.<br>
<br>
What is the output of "curl -v" on the first request? If it is not<br>
exactly what you expect, what does the nginx log say for that one request?<br>
<br>
Good luck with it,<br>
<br>
        f<br>
<span class="HOEnZb"><font color="#888888">--<br>
Francis Daly        <a href="mailto:francis@daoine.org">francis@daoine.org</a><br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Regards,<br>Ajay<br></div>
</div>