Configurar Let's Encrypt con múltiples dominios / redireccionamientos

NOTE: @pfaffman says: This page needs to be cleaned up. There is now a new ENV setting that will let you add more hostnames. In your app.yml under your DISCOURSE_HOSTNAME line (it can go many places but that one makes sense), add

 DISCOURSE_HOSTNAME_ALIASES: domain.com,other.domain.com

and early reports suggest that you’ll get valid certs for those domains and that accessing https://domain.com will properly redirect you to your DISCOURSE_HOSTNAME without a certificate error.

If you do that and it works for you, you might add another “me too!” post to the bottom. If you feel comfortable, you could also edit this first post with the instructions that you think would be most helpful.


This is to address the problem where you get certificate errors with any redirects or CNAME DNS entries which point to your actual installed Discourse (sub)domain.

If you do not have https configured already (you do if you have done a standard install recently) see Setting up Let’s Encrypt as your first step.

Legacy Method

The method below no longer reliably works as of August 2025

There are three patterns that need to be replaced. Enter your (sub)domain (and any additional subdomains preceded by -d ) and then add the following to your app.yml hooks section (towards the end of the file):

2025-04-23 @pfaffman changed the code because there’s a 3rd place it needs to be changed

  after_ssl:
    - replace:
        filename: /etc/runit/1.d/letsencrypt
        from: /-d =domain1= /
        to: "-d =domain1= -d =domain2= "
        global: true

This will allow you to have HTTPS configured for a second domain that will redirect to the correct one without certificate issues.

If you need to add multiple extra domains, you can enter something like this in the domain2 field: www.bananas.com -d forum.bananas.com

For example, if you want people who visit https://forum.example.com to be redirected to your forum at https://community.example.com without a certificate error, this is all you need.

47 Me gusta
Discourse + Let's Encrypt w/ multiple hostnames
Problem in installing Let's Encrypt SSL for www and non-www
Making 'www' work with Discourse
LetsEncrypt working without www, not with www
Full site CDN acceleration for Discourse
Two domains, conditional redirect
How to setup 301 redirect -non-www to www
Setup Let’s Encrypt + non-www > www
How to create 301 redirect to a new domain
(Superseded) Redirect additional domain(s) to your Discourse instance
Best way to add a 301 redirect
Setup discourse for the main site (www.example.com) not on a subdomain
Www.example.com OK, but example.com NOT
About force www to non www
Why is the Apple Touch Icon loaded via HTTP instead of HTTPS?
DNS Settings for Digital Ocean Droplet - Root Domain?
DNS Settings for Digital Ocean Droplet - Root Domain?
SSL working on root, but not on www
Facebook login was flagged as non compliant by Facebook after change to Let's Encrypt certificate system
After activating HTTPS Discourse doesn´t work
Letsencrypt issued on every build?
DO Storage and uploaded backups not showing
Non www to www without certificate error
Non www to www without certificate error
Infinite 301 redirect with reverse proxy setup
How to add ssl to non-www domain?
Adding www. to Domain
Discourse droplet unreachable on 80,443 ports after installation on Ubuntu 20.04
Installation without subdomain not working
Forum went down, then certificate renew error regarding firewall configuration?
Discourse Failing to Work
Change server to a two-container setup
LetsEncrypt certificate not renewing
How to redirect http to https on digital ocean droplet?
Redirect old forum URLs to new Discourse URLs using permalinks
Forwarding from https:// to https://www
Workaround for the 1 week Let's Encrypt limit
DNS settings for www
Migrate discourse from main domain --> subdomain
Migrate a XenForo forum to Discourse
How can I update the nginx config directly in discourse/docker ..?
Let's Encrypt with sub-subdomain?
Problems building a new server
Multiple hostnames for a single site for cut-over phase
Help with URLs not working on Chrome
Issue after Rebuilding Discourse on Digital Ocean Droplet
Help with URLs not working on Chrome
Error on attempting to remap links
Unable to reinstall Discourse
Can't load site in Safari
(Superseded) Redirect additional domain(s) to your Discourse instance
Lets Encrypt Certificate - Issuing Problem
Www to non www with https
(Superseded) Redirect additional domain(s) to your Discourse instance
Discourse setup completed successfully but not working due to SSL error
SSL on new host
Problem in installing Let's Encrypt SSL for www and non-www
Install fails on fresh Debian 12 installation
Setup Multisite Configuration with Let's Encrypt and no Reverse Proxy
SSL is not valid for www.domain.com
SSL is not valid for www.domain.com
Trying to set up Discourse on my website
Setup Let’s Encrypt + non-www > www
Changed email service, now the forum won't resolve via IP address nor URL
Bootstrap error during Discourse install: ENOENT - /etc/runit/1.d/letsencrypt
DNS settings for www
Discourse not accessible - SSL Issue
Correct DNS records to set when Discourse is hosted on WWW subdomain?
Invalid certificate name when using www
Multisite configuration with Docker
PEM_read_bio_X509_AUX() failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE)
Rebuild appears to work, but site is not loading properly
Issue with app.yml file update
Problem in installing Let's Encrypt SSL for www and non-www
New install on ionos ubuntu 22.04 vps keeps failing
Connection Timeout/Security Issue
Let's Encrypt Limit (again)
Port issue - Please help
Sysadmins Index
Set Up Let's Encrypt with Second Domain for Existing Discourse Install
New domain new server and 301 redirect
Is anyone here using their Discourse instance as their entire website?
Able to receive e-mail in mail-receiver but NOT in Discourse?
I can't access after installing
Setting up Discourse
Migrating site from Personal vmware server to VPS
New install fails on Ubuntu 20.04.3 LTS
Discourse Setup Error