title: What is the correct URL format to send to an HTTP proxy server?
body: <p>When my application requests a particular URL from a server (over https), it gets a 301 Moved Permanently redirection. However the Location header is badly-formed. I see something like this:</p>
  <pre><code>&gt; GET https://myserver/url HTTP/1.1
  &lt; 301 Moved Permanently
  &lt; Location: https://redirectedserverhttp://myserver/url
  </code></pre>
  <p>If I send the request without the host, I get a correctly-formed URL:</p>
  <pre><code>&gt; GET /url HTTP/1.1
  &lt; 301 Moved Permanently
  &lt; Location: https://redirectedserver/url
  </code></pre>
  <p>I am going through a proxy server and according to <a href="https://www.rfc-editor.org/rfc/rfc2068#section-5.1.2" rel="nofollow noreferrer">RFC 2068</a> section 5.1.2, &quot;<em>The absoluteURI form is required when the request is being made to a proxy</em>&quot; so it looks like I'm doing it the right way but the proxy is responding incorrectly. If I try this through a browser, curl, or wget it works fine. I looked at the wget code and the logic looks like:</p>
  <pre><code>if( proxy &amp;&amp; !https ) {
      use absoluteURI
  } else {
      use relativeURI
  }
  </code></pre>
  <p>Wget even has a comment in its source code:</p>
  <pre><code>/* When using SSL over proxy, CONNECT establishes a direct
     connection to the HTTPS server.  Therefore use the same
     argument as when talking to the server directly. */
  </code></pre>
  <p>Is this an actual standard defined somewhere? If the absolute URI form is supposed to be used, why do the other tools <strong>not</strong> use it, and why is it failing?</p>