title: Nginx Proxy Manager 502 Bad Gateway error only on https mode
body: <p>I have a problem with my Nginx Proxy Manager and HTTPS. My Nginx Proxy Manager runs on docker. And my PiHole redirects my domain (sub.domain.de) with a custom dns record back to my server (on Port 80) where Nginx Proxy Manager is running. The Proxy Manager is configured to use the Ports of the docker container I want connect to (for exaple 192.168.178.35:6595).</p>
  <p>I get this error:</p>
  <pre><code>2022/01/09 11:43:57 [error] 1636#1636: *21857 SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream, client: 172.17.0.1, server: sub.domain.de, request: &quot;GET / HTTP/2.0&quot;, upstream: &quot;https://192.168.178.35:6595/&quot;, host: &quot;sub.domain.de&quot;
  </code></pre>
  <p>My domain has a valid Let's Encrypt certificate which also works, but only if I set the Proxy Manager to http and force ssl. But if I say https, it gives me the error &quot;502 Bad Gateway&quot;. With Https I mean this: <a href="https://i.stack.imgur.com/B0YAA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B0YAA.png" alt="Nginx Proxy Manager Config Picture" /></a></p>
  <p>Here is my Nginx Proxy Manger config for this domain example.</p>
  <pre><code># ------------------------------------------------------------
  # sub.domain.de
  # ------------------------------------------------------------
  
  server {
    set $forward_scheme https;
    set $server         &quot;192.168.178.35&quot;;
    set $port           6595;
  
    listen 80;
  listen [::]:80;
  
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  
    server_name sub.domain.de;
  
    # Let's Encrypt SSL
    include conf.d/include/letsencrypt-acme-challenge.conf;
    include conf.d/include/ssl-ciphers.conf;
    ssl_certificate /etc/letsencrypt/live/npm-10/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/npm-10/privkey.pem;
  
  
    access_log /data/logs/proxy-host-19_access.log proxy;
    error_log /data/logs/proxy-host-19_error.log warn;
  
    location / {
  
      # Proxy!
      include conf.d/include/proxy.conf;
    }
  
    # Custom
    include /data/nginx/custom/server_proxy[.]conf;
  }
  </code></pre>