trying to setup wildcard domain with cloudflare
ramezj
HOBBYOP

a month ago

Hello, I'm trying to setup a Wildcard Domain with cloudflare, I've added the DNS Records, I've changed the SSL Mode to Full. What could be wrong?

Solved$10 Bounty

Pinned Solution

For TLS certs, railway would automatically issue it for you, but since you are using cloudfare proxy, railway wont.
So either you can just update the DNS as "DNS only" and let railway issue a cert automatically for you

7 Replies

can you make sure that you added the records as it is provided by railway?

if you are trying to add www.website.com & website.com both, you should see Name something like below


ramezj
HOBBYOP

a month ago

Ok. just did so, I have added CNAME, www that points to the same content of the normal domain, as seen in the screenshot.

Attachments


Hey @ramezj, adding the same content for two different CNAMEs is incorrect. Please delete any existing record of the website from cloudfare, and follow these steps -
You need to add two custom domains in railway -> 1. www.website.com and 2. website.com

Railway will give you two CNAME records for each of these (they will be of type CNAME, with different NAME and content value), and you need to add these two records in cloudfare individually (as shown in previous screenshot).
In DNS, these two are treated as different domains, and hence needs to be added separately.

Let me know if you run into any issues adding these.


ramezj
HOBBYOP

a month ago

well I can't do that because I've hit the "domains limit"
for more context, I'm trying to setup wildcard domain because I'm working on a multi-tenancy project where I have to setup subdomains.


okay got it.
So you are adding two domains in railway - wegotwork.co & *.wegotwork.co
The later one will cover for all the wildcards. The only thing I see missing is incorrect setup in your cloudfare.

See while adding the domain1 (wegotwork.co), Railway would give you -
CNAME @ <value1>

and domain2(*.wegotwork.co), Railway would give you two records-
CNAME _acme-challenge <value2>
CNAME * <value3>

Add these 3 records in your cloudfare as it is. I dont see the @ one in you DNS settings. And remove any unncessary records like CNAME www


For TLS certs, railway would automatically issue it for you, but since you are using cloudfare proxy, railway wont.
So either you can just update the DNS as "DNS only" and let railway issue a cert automatically for you


ramezj
HOBBYOP

a month ago

i removed and re added *.wegotwork.co to railway, it gave me an extra TXT Record.

This setup worked fine. however, I don't really understand what was wrong.

Thank you so much!


Status changed to Solved brody about 1 month ago


Loading...