I have a question about domains system

4 months ago

I have a question: does your domain system accept my CNAME system? For example, I have a multi-tenant system, and I need it to work with multiple domains, and my customers can point the domain to the platform. Is this possible? Currently, I release cname.domain.tld to my customers, and they point CNAME to their domains.

Solved$10 Bounty

163 Replies

4 months ago

My system is a store for game servers, similar to tebex.


4 months ago

When I point to a custom domain, I get an error.

1441912994459160600


4 months ago

This error occurs when I try to access the custom domain that is pointed to in the CNAME.

1441913387155062800


Did you make sure the proxied port is the port your application is listening to?


dtknepper
PRO

4 months ago

Hi man,

I am currently working on a similar style app and what I am doing is the following.

1. Setup a wildcard domain on railway so you can have customer.pingalways.com

  1. Setup cloudflare for saas on your pingalways.com domain

  2. Do all routing/rewriting through cloudflare.


4 months ago

Hey, Railway has support for wildcard domains. Here's the full documentation on how to set it up: https://docs.railway.com/guides/public-networking#wildcard-domains.

I would recommend removing any custom domains (even DNS records) you've added and trying again from scratch by following the documentation above.

If you hit any roadblocks, let us know!


passos

Hey, Railway has support for wildcard domains. Here's the full documentation on how to set it up: https://docs.railway.com/guides/public-networking#wildcard-domains.I would recommend removing any custom domains (even DNS records) you've added and trying again from scratch by following the documentation above.If you hit any roadblocks, let us know!

4 months ago

I'll take a look to do it that way.


dtknepper

Hi man,I am currently working on a similar style app and what I am doing is the following.1. Setup a wildcard domain on railway so you can have customer.pingalways.comSetup cloudflare for saas on your pingalways.com domainDo all routing/rewriting through cloudflare.

4 months ago

I'll try that way too.


4 months ago

From what I've seen in the documentation, do I need to register each of my clients' domains in your dashboard?


4 months ago

My current setup, railway and Cloudflare (DNS and CF for SaaS). Is there anything wrong with it?

1442988746952937500
1442988747221107000
1442988747691135000


4 months ago

I am getting the error “Invalid SSL certificate” when pointing to the domain hyren.luccabassoli.com (example domain for a customer's store). This domain is pointed to cname.hyren.net and configured in Cloudflare for SaaS, which I use their API to register.

1442989472655347700


4 months ago

@Chandrika can you helpme?


4 months ago

Please don't ping team members! #🛂|readme 5)



3 months ago

Hi?


3 months ago

Hi?


3 months ago

Hey @Lucca Bassoli, I'm trying to understand your case. Do you have multiple client domains that you want Railway to support? Are these domains dynamic rather than static?


3 months ago

||sorry for accidental ping ludwig||


3 months ago

If that's a yes, then I'm afraid your case isn't supported. Railway currently only supports a set of known domains. I'm guessing that your use case is some kind of shop that users can create and is known by their own custom domain.


3 months ago

I have a system where my system's client can point their domain through cname. I release a cname (cname.hyren.net) and it points to domain.tld, but when it points, it does not show the website and gives an SSL error. Do I need to register the client's domain in the railway domains?


3 months ago

Yes, you're required to register your client's domain in Railway.


3 months ago

Is there a limit? Can I change my limits? Because I would need to run more than 100 stores.


3 months ago

Yes, the Pro Plan is limited to 20 domains per service. The Railway Team might increase this limit upon request.



3 months ago

I saw that thread, but it seems they didn't get anywhere.


3 months ago

So it seems to me that this is not possible to do on the Railroad.


3 months ago

On Railway no, on Cloudflare, yes.


3 months ago

Okay, but I use Cloudflare for SaaS. How can I point to the application? How do I do that in Cloudflare?


3 months ago

I'm sorry but we cannot provide support for 3rd party services, I'll let the community assist with that.


3 months ago

I'm unfamiliar with Cloudflare SaaS, but I'm testing how it would work on your specific setup, give me a minute.


3 months ago

I've managed to figure it out, but be aware, it's quite complicated to follow.

  1. Since Cloudflare only allows Host header rewrites on Enterprise plans, we'll not be able to use Railway's proxy so deploy an Nginx instance on Railway and expose it via TCP proxy to access its port directly.

  2. Configure Cloudflare SaaS. When defining your fallback origin (where traffic routes), specify your TCP proxy's domain without the port number as a CNAME.

  3. Create an origin rule in Cloudflare to route all incoming traffic to Railway's TCP proxy port.

  4. Under Cloudflare's SSL/TLS settings, enable Flexible encryption mode to allow the HTTP traffic.

If you really want to proceed with it, let me know and I can guide you through their dashboard using screenshots. However, I completely understand if you choose not to, as unfortunately, I don't think Railway is the best option for you in this situation.

Maybe the team can increase your domain limits, after which you'll be able to complete the task either manually or via API until Railway develops a more effective solution for this issue.


3 months ago

  1. You can do it with snippets -


3 months ago

Only available on Pro Plans and above. I won't be able to help here on how to set up the snippets as I don't have the Pro Plan. But in theory, it should be a simple script to rewrite the Host header to be yours and then include an extra header to identify which domain it is.


3 months ago

Humm


3 months ago

I am interested in continuing, as Ralway is a good place to deploy and I already have several applications with them. If you could help me with step-by-step instructions on printing 🙂 That would even help the community.


3 months ago

Cloudflare Snippets is only available on the Pro plan. I am currently on Cloudflare's free plan. I only pay for their SaaS.


3 months ago

I think if you are running a business and you use Cloudflare it would be reasonable to be on their Pro plan?


3 months ago

If I can do it for free, there's no reason to pay for it. I don't have that many customers. I only use their routing for SaaS and some blocking rules. But I intend to pay for it. I just don't see much reason to do so yet.


3 months ago

Great, just give me sometime to get off work (might take awhile), i'll mention you here.


3 months ago

Okay, thanks for your help. I look forward to hearing from you!


3 months ago

Hey, are you available now?


3 months ago

Hi


3 months ago

I wasn't home at that time, but if you want, you can send it and I'll take a look. I don't think we'll be able to synchronize due to the time zones, haha.


3 months ago

@Lucca Bassoli Are you able to follow it? If you have any questions, just send them here. I'll be active.


3 months ago

How do I upgrade nginx? The Railway template I saw here doesn't save the data correctly.


3 months ago

Can you send me your DNS record settings? Mine already has flexible SSL.


3 months ago

Sorry for delay, I would recommend using the Nginx Proxy Manager as it offers a nice UI to manage it


3 months ago

1445542153894891800


3 months ago

I installed that one, but it isn't saving the data. It seems that when it restarts, it loses the credentials and settings. How did you solve that?


3 months ago

Mine is like that too.


3 months ago

I reinstalled nginx proxy manager. How are your settings in it?


3 months ago

It isn't? will confirm


3 months ago

Instead of Nginx Proxy Manager, use something else


3 months ago

Instead of Nginx Proxy Manager, use the Caddy template.

  1. Deploy the template

  2. Click on the service created, go to settings and then eject, follow instructions to eject

  3. On the repository created by Railway, modify the Caddyfile to be something like this:

:{$PORT} {
    reverse_proxy :
}

3 months ago

What is the caddy template? I don't understand.




3 months ago

Try that first and then I'll get you a better config that handles service replicas and more


3 months ago

Ok


3 months ago

It seems to me that what I sent is the same, isn't it?


3 months ago

Change made


3 months ago

1445844913638867000


3 months ago

remove everything else


3 months ago

just keep the lines from 1-3


3 months ago

Removed


3 months ago

1445845549952532500


3 months ago

Now should I point the CNAME to this service?


3 months ago

Great, did you already enable Cloudflare SaaS?


3 months ago

Yes


3 months ago

Now, you'll add a TCP proxy to your Caddy application


3 months ago

1445846243141222400


3 months ago

This?

1445846409063563300


3 months ago

Yep, first add the PORT environment variable to your service, PORT=8080 is define


3 months ago

A gente está falando em ingles e agora vi que vc é br 😐


3 months ago

On here, each customer you add will need to be added there, you can remove your CNAME


3 months ago

Ok


3 months ago

Yeah, but Railway wants to keep every message in here in English. It keeps things more organized.


3 months ago

Ok


3 months ago

The custom host name cname.hyren.net has been deleted.


3 months ago

1445847098024136700


3 months ago

Which door should I put here?


3 months ago

Set 8080


3 months ago

Done


3 months ago

Railway will give you a combination of domain:port, create a CNAME pointing to the domain only


3 months ago

Ok


3 months ago

Done


3 months ago

Now, add that CNAME as a fallback origin


3 months ago

No, sorry


3 months ago

give me a minute


3 months ago

Ok


3 months ago

After you've added that CNAME, create another one that points to that one

So if you've created proxy-fallback.hyren.net thats points to Railway for example, create another CNAME that points to that, for example customers.hyren.net points to proxy-fallback.hyren.net


3 months ago

And then add the proxy-fallback.hyren.net into Cloudflare SaaS as a fallback origin


3 months ago

Like this?

1445849374142894000
1445849374360867000
1445849374621040600



3 months ago

Done

1445849876414861600


3 months ago

No, on Railway remove the custom domain


3 months ago

you should get the combination below it shuttle.<…>


3 months ago

And then create a CNAME to it


3 months ago

That way?

1445851182827307000


3 months ago

Great, just fix this


3 months ago

Fixed


3 months ago

1445851558595137800


3 months ago

Now we'll create a page rule to redirect all traffic to that Railway port


3 months ago

Can you find where we can create that? I don't have the URL unfortunately


3 months ago

It should be in the sidebar, named as "rules" or "origin rules"


3 months ago

Yes


3 months ago

I am on the page.


3 months ago

1445852867142484200


3 months ago

1445852948415516700


3 months ago

No, it's another one


3 months ago

Should be in the same category in the sidebar


3 months ago

1445853303001845800


3 months ago

Try "Visão geral"


3 months ago

1445853744502800400


3 months ago

1445853838476181500


3 months ago

Click on "Nova Regra"


3 months ago

1445853995632558000


3 months ago

Sorry, go to "Modelos" and then navigate to the last page, where you should find a "Change Port" template.


3 months ago

For me, that option is not available.


3 months ago

It does not appear on the list.


3 months ago

It's the last page, first item

1445855328372527000


3 months ago

Can you click on it and send me the link it redirected you to? I'll change the parameters according to my account.



3 months ago

Good!


3 months ago

It worked haha, I'm here.


3 months ago

1445856020449595400


3 months ago

Great, now on Rewrite to set 23113 (the same as Railway), also make sure to set the following Custom Filter Expression

1445856551284768800


3 months ago

Done


3 months ago

1445857571415265500


3 months ago

1445857651195122000


3 months ago

That should've been the last step but I'm unable to connect to your Caddy service, are you sure it's up? http://shuttle.proxy.rlwy.net:23113/


3 months ago

Yes, but it seems that it is not on the correct port where the TCP proxy was generated. From what I can see in the logs, it is running on another port.


3 months ago

2019 or 80?

1445858646863905000


3 months ago

1445858774094057700


3 months ago

Definitely weird, you added the PORT environment variable, right?


3 months ago

If not, maybe try 2019 on Railway


3 months ago

True, I hadn't seen the email. It's running at 80.



3 months ago

working now


3 months ago

I'm seeing it's working https://hyren.luccabassoli.com/ 👀


3 months ago

One question: do I need to register cname.hyren.net in the application?


3 months ago

In the application, it is as follows

1445859675512901600


3 months ago

No, cname.hyren.net is not used.


3 months ago

Ok


3 months ago

Every customer that you add simply needs to be added on Cloudflare


3 months ago

If you want to automate that, Cloudflare has APIs for that.


3 months ago

I can no longer access the main domain. Do I need to point it to the CNAME?


3 months ago

Maybe it's related to the SSL/TLS flexible option as Cloudflare is now sending HTTP traffic instead of HTTPS


3 months ago

ERRTOOMANY_REDIRECTS is occurring


3 months ago

What you can do is turn on the Full option.


3 months ago

And then change your Caddy config to generate a self signed certificate
Something like this should do the trick:

{
    acme_ca internal
}

:${PORT} {
    tls internal
    reverse_proxy :
}

3 months ago

To be sure, turn on the Full option first and see if it recovers the main domain


3 months ago

I activated Full, the main domain came back, but the one using cname stopped working.


3 months ago

yeah, then follow my instructions here


3 months ago

Ok


3 months ago

Error: adapting config using caddyfile: parsing key: invalid port '${PORT}': strconv.Atoi: parsing "${PORT}": invalid syntax

3 months ago

change :${PORT} to :{$PORT}


3 months ago

A new error occurred

Error: adapting config using caddyfile: automation policy from site block is also default/catch-all policy because of key without hostname, and the two are in conflict: []certmagic.Issuer(nil) != []certmagic.Issuer{(*caddytls.InternalIssuer)(0xc0002d3560)}

3 months ago

Resolved


3 months ago

:{$PORT} {
    tls internal
    reverse_proxy hyren-web.railway.internal:8080
}

3 months ago

Great, any more issues that you're having?


3 months ago

None, thank you very much for your help! 🤝 🇧🇷



Status changed to Solved passos 3 months ago


Loading...