title: NGINX proxy_pass same protocol (http/https)
body: <p>I have a section in my NGINX config file that uses <code>proxy_pass</code> to redirect API traffic to upstream servers. I have the <code>location</code>s in one <code>server</code> block that serves both http and https requests:</p>
  
  <pre><code>server {
      listen 80;
      listen [::]:80;
      listen 443 ssl;
      listen [::]:443 ssl;
      server_name mysite.local;    # Valid TLD in production
  </code></pre>
  
  <p>I then have <code>location</code> blocks to define my API gateways:</p>
  
  <pre><code>    location /api/v1/json {
          # Various proxy config directives
          proxy_pass http://upstream;
  </code></pre>
  
  <p>My question is: would it be possible to drop <code>http://</code> and pass requests to my upstream servers depending on the protocol without splitting my <code>server</code> block? Something like HTML/JavaScript <code>//mysite.local</code> requests.</p>