Stopper 1: NGINX Proxy Mixed Content Error

I’m consistently encountering mixed-contents errors and need assistance to resolve this.

I’m using Nginx (running on AlmaLinux 9.4) to reverse proxy Discourse (standard Docker version 26.1.3, build b72abbb installation) running on Ubuntu 22.04). If I set force https, I cannot log in. The situation is the same as described in a previous thread.

I’m looking for a systematic approach to break down this problem into manageable parts. Your guidance and insights would be invaluable in this process.

Discourse is an impressive piece of software. It’s transforming discussions into knowledge for more and more companies, including our small research centre. We’ve been testing it for months, and despite a few issues, we’ve managed to overcome them with your help.

I want to propose it as our standard for civilized discussion, but before I can do so, I must explain why I cannot solve some apparently simple issues like this. Your help will be very welcome! Thanks for your help!

This thread solves how to force https and get login and all other actions functioning to the extent I’ve been able to test so far.

I’m still getting some mixed-errors messages, though. I will keep investigating and keep this topic updated.

Thanks!

Stopper 1 solved! No more mixed content messages with any browser (I tried Firefox, Opera and Safari on macOS). This change in Nginx reverse proxy solved also the issue described in my post Problem Responding to a Topic.

As a reference, I’m also posting the updated Nginx conf file:

server {
    server_name forum.igfae.usc.es;

    location / {
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         "http://172.16.57.96";
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/forum.igfae.usc.es/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/forum.igfae.usc.es/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    if ($host = forum.igfae.usc.es) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name forum.igfae.usc.es;
    listen 80;
    return 404; # managed by Certbot

}

At the moment of creating this post, Nginx/1.20.1 is running as a reverse proxy on a AlmaLinux release 9.4 (Seafoam Ocelot) server.

Discourse 3.3.0.beta3-dev is running on Docker version 26.1.3, build b72abbb on an Ubuntu 22.04.4 LTS box.

<meta name="generator" content="Discourse 3.3.0.beta3-dev - https://github.com/discourse/discourse version 625c71585623d891751b8abd291337fda3724947">

Thanks to everyone!

Try hardcoding it to https:

proxy_set_header X-Forwarded-Proto https;

I was struggling to understand this proposal. Why should we try hardcoding it to https if $scheme works? Thanks!

I didn’t read very well.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.