September 19, 2022 02:26PM

Maybe I'm misunderstanding how this should work. Can I use non-ssl
connections for upstream servers when the originating request is https?

I'm forwarding nginx requests to an apache server listening on 8080.
Everything works fine if I explicitly use http but not https. My nginx
site itself has no problem with https and all http traffic is forwarded
to https. However when I try to go to wordpress (on apache) I get an
error in my browser that I am forwarding plain http to https, and indeed
the port I see in the browser is 443 not 8080. Again if I explicitly
request http I'm good but it fails with https. Why is nginx forwarding
this traffic to 443 instead of 8080? Or probably better how do I change
this behavior?

So I'm trying to find out how nginx makes that decision. This is the
stanza nginx conf file.

server {
        listen 80 default_server;
        listen [::]:80;
        return 301 https://$hostname$request_uri;


 listen 443 ssl http2;
        listen [::]:443 ssl;

        ssl_certificate         /etc/nginx/ssl/certificates.crt;
        ssl_certificate_key     /etc/nginx/ssl/private.key;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;

location /wordpress {
                proxy_buffering on;
                proxy_buffers 12 12k;
                proxy_redirect off;

                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host:8080;


nginx mailing list --
To unsubscribe send an email to
Subject Author Posted

forward 443 requests to correct (?) port

biscotty September 19, 2022 02:26PM

Re: forward 443 requests to correct (?) port

Eric Germann via nginx September 19, 2022 02:48PM

Re: forward 443 requests to correct (?) port

biscotty September 19, 2022 04:58PM

Re: forward 443 requests to correct (?) port

Francis Daly September 19, 2022 08:00PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 317
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready