Nginx multiple upstream with different protocols

Cox, Eric S eric.cox at
Wed Feb 22 14:58:26 UTC 2017

If you are SSL on the frontend (server directive) why would you want to proxy between ssl/non-ssl on the upstreams? Can they not be the same? I don't get what you are trying to solve?

From: nginx [mailto:nginx-bounces at] On Behalf Of Kilian Ries
Sent: Wednesday, February 22, 2017 9:55 AM
To: nginx at
Subject: Nginx multiple upstream with different protocols


i'm trying to setup two Nginx upstreams (one with HTTP and one with HTTPS) and the proxy_pass module should decide which of the upstreams is serving "valid" content.

The config should look like this:

upstream proxy_backend {

        server xxx.xx.188.53;

        server xxx.xx.188.53:443;


server {

        listen 443 ssl;


        location / {

                proxy_pass http://proxy_backend<>;

                #proxy_pass https://proxy_backend<>;



The Problem is that i don't know if the upstream is serving the content via http or https. Is there any possibility to tell nginx to change the protocol from the proxy_pass directive? Because if i set proxy_pass to https, i get an error (502 / 400) if the upstream website is running on http and vice versa.

So i'm searching for a way to let Nginx decide if he should proxy_pass via http or https. Can anybody help me with that configuration?





This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list