<div dir="ltr">At the location/server level try:<br><div><br></div><div style>if ($is_args) {</div><div style><div>    return 301 https://$host$request_uri&source=server1;</div></div><div style>}</div><div><br></div><div style>
## Goes here if the above is not chosen.</div><div style>return 301 https://$host$uri?source=server1 ;<br></div><div style><br></div><div style><br></div></div><div class="gmail_extra"><br clear="all"><div>----appa<br><br>
</div>
<br><br><div class="gmail_quote">On Mon, Jul 1, 2013 at 11:18 PM, Jonathan Vanasco <span dir="ltr"><<a href="mailto:nginx@2xlp.com" target="_blank">nginx@2xlp.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br>we'd like to add onto the query string an identifier of the nginx server<br><br>something like:<br><br><span style="white-space:pre-wrap">      </span>return 301 <a href="https://$host$request_uri?source=server1" target="_blank">https://$host$request_uri?source=server1</a> ;<br>
<br>the problem is that we can't figure out how to make this work correctly when the url already contains query strings.<br><br><br>Example:<br><span style="white-space:pre-wrap">   </span>return 301 <a href="https://$host$request_uri?source=server1" target="_blank">https://$host$request_uri?source=server1</a> ;<br>
<span style="white-space:pre-wrap">     </span>Good!<br><span style="white-space:pre-wrap"> </span><span style="white-space:pre-wrap">        </span>in  /foo.bar <br><span style="white-space:pre-wrap"> </span><span style="white-space:pre-wrap">        </span>out /foo.bar?source=server1<br>
<span style="white-space:pre-wrap">     </span>Bad!<br><span style="white-space:pre-wrap">  </span><span style="white-space:pre-wrap">        </span>in  /foo.bar?a=1<br><span style="white-space:pre-wrap">      </span><span style="white-space:pre-wrap">        </span>out /foo.bar?a=1?source=server1<br>
<br>How can we get this?<br><div><span style="white-space:pre-wrap"><span style="white-space:normal"><br></span>  </span><span style="white-space:pre-wrap">        </span>in  /foo.bar <br><span style="white-space:pre-wrap"> </span><span style="white-space:pre-wrap">        </span>out /foo.bar?source=server1<br>
<br><span style="white-space:pre-wrap">   </span><span style="white-space:pre-wrap">        </span>in   /foo.bar?a=1<br><span style="white-space:pre-wrap">     </span><span style="white-space:pre-wrap">        </span>out /foo.bar?a=1&source=server1<br>
<br><br></div></div><br>_______________________________________________<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" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div>