Chris_Valentine reported a 502 Bad Gateway error after restarting their Discourse instance, suspecting Ruby/Rails as the cause. neounix confirmed Rails runs on port 3000 and suggested checking Rails logs. itsbhanusharma noted the issue may stem from improperly changing the domain name, recommending this guide. Chris later revealed a misconfiguration causing images to load from a development domain without a certificate, triggering cross-site security issues 4. Complicating matters, traffic routed through Cloudflare interfered with SSL certificates, prompting pfaffman to advise disabling Cloudflare temporarily for Let’s Encrypt to work. Ultimately, Chris confirmed the issue was resolved after rebuilding the container and successfully configuring Let’s Encrypt 7.
We have a Discourse that’s been running for at least three years and yesterday I made the mistake of restarting the instance in the hope it would take a domain change. The instance is running and we can see nginx is seeing requests form outside, but all visitors are getting “502 Bad gateway” all the time. Here’s an example entry in the nginx error log:
There’s no webserver running outside Docker so the app.yml file simply forwards 80 and 443 into the container. But what is supposed to be on port 3000? Is it suppose to be Ruby / Rails?
There is a “development” alternative to the live domain and somehow that has sneaked into the configuration such that everything but the images comes from the live domain but the images are coming from the dev domain. As the latter doesn’t have a certificate, we (quite rightly) run into the cross-site security issue and the images don’t load.
We are currently trying to rebuild the container, as suggested elsewhere.
An additional complication is that all traffic is going through CloudFlare so we’re now having problems with SSL certificates. Note sure if templates/cloudflare.template.yml still works?