Senthil migrated their Discourse instance and noticed that embedded images and email links incorrectly include :80 in the URL (e.g., https://thinnal.org:80/...), breaking image display. They confirmed force_https is enabled and their Let’s Encrypt certificate is valid, ruling out HTTPS misconfiguration. After checking settings, they discovered the SiteSetting.port was manually set to "80" — a developer-only setting that should not be used in production. Senthil resolved the issue by entering the Rails console and setting SiteSetting.port = nil. codinghorror clarified that port is not meant for production use and expressed surprise that it was set, suggesting the issue likely stemmed from a migration or misconfiguration during setup. The root cause was an unintended port setting interfering with URL generation, even though HTTPS was properly configured. This affected not only image embeds but also post-authentication redirects, which similarly displayed :80. The fix restored correct URL behavior by removing the erroneous port override.
I recently migrated my server, and I have no custom Nginx running in front of my discourse instance.
This is the regular plain vanilla discourse, set up following the Quick Start Guide. The content has been migrated from another server.
In the emails sent by the instance, I see that the domain is set like this https://domain.org:80