Infinite loop behind SSL proxy on non-standard port

I need to run a WordPress instance on a non-standard SSL port (8080). I'm using Docker containers and nginx as a reverse proxy.

Here's the relevant portions of docker-compose.yml:

  wordpress:
    image: wordpress:latest
    # no ports are open besides 80 internally exposed

(...)

  proxy:
    image: jwilder/nginx-proxy
    ports:
      - "8080:8080"

And for nginx.conf:

server {
        server_name domain.com;
        listen 8080 ssl;

        ssl_certificate certs/domain.crt;
        ssl_certificate_key certs/domain.key;

        # Proxy parameters
        #proxy_set_header       Host                    $host;
        proxy_set_header        X-Real-IP               $remote_addr;
        proxy_set_header        X-Forwarded-For         $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto       $scheme;

        proxy_buffering on;

       location / {
            proxy_pass      http://wordpress;
       }

Topic proxy nginx redirect https ssl Wordpress

Category Web


Changing

proxy_set_header Host $host;

to

proxy_set_header Host $http_host;

fixed the issue.

(source)

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.