title: nginx domain forwarding with added parameter
body: <p>I keep getting a strange issue on nginx right now. I have two nginx servers, one hosting content that I want to forward to the other server. The one that is doing the forwarding has a sites enabled config of:</p>
  
  <pre><code>server {
    listen 80;
    server_name pastdomain.com;
    return 301 https://domain.com$request_uri?from_past_domain=true;
  }
  
  server {
    listen 443;
    server_name pastdomain.com;
    return 301 https://domain.com$request_uri?from_past_domain=true;
  
   # bunch of ssl config here
  }
  </code></pre>
  
  <p>Basically I want to send all traffic to the new server where it can get interpreted with a new get variable from_past_domain that I can interpret as needed on the new server. </p>
  
  <p>ie.
  pastdomain.com/thing/thing1/1/</p>
  
  <p>would translate to</p>
  
  <p>domain.com/thing/thing1/1?from_past_domain=true</p>
  
  <p>Right now it appears to be working except in the case where I just visit pastdomain.com</p>
  
  <p>I instead get domain.com//?from_past_domain=true</p>
  
  <p>which is incorrect. In addition, it doesn't add new get parameters correctly. </p>
  
  <p>ie. if I have pastdomain.com?test=1&amp;test2=2 it forwards to domain.com/?test=1&amp;test2=2?from_past_domain=true</p>
  
  <p>How can I go about forwarding this correctly?</p>