nginx proxy_pass with https protocol leads to "invalid URL prefix" error
<p>I'm running a php app behind nginx on dokku. I got a location with a proxy_pass directive defined like this:</p>

<pre><code>location ~* ^/cdn/(.*?)/(.*) {
  resolver 8.8.8.8;
  proxy_set_header HOST $1;
  proxy_pass https://$1/$2?$args;
}
</code></pre>

<p>I'd like to use this location to redirect files from S3.</p>

<p>In the error logs I have the following error:</p>

<pre><code>2016/10/03 21:56:46 [error] 251#0: *11 invalid URL prefix 
  in "https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg?", 
  client: 172.17.0.1, server: localhost, 
  request: "GET /cdn/s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg HTTP/1.1"
</code></pre>

<p>Everything works well if I change <strong>https://</strong> and use <strong>http://</strong> instead.</p>

<p>Any hints appreciated. </p>