4 months ago
Good day,
I want to deploy a static website and it works good.
But when I want to attach custom domain, then it requires me to provide a port.
Which port shall be provided? I tried 80 and 443, but there is still SSL certificate issue and
curl -k https://donationraffle.app/
{"status":"error","code":502,"message":"Application failed to respond","request_id":"4qHOij8MR7yz8xDBm3z_FQ"}What is the correct solution for this setup?
12 Replies
4 months ago
Your port will depend on what port your application is listening to.
But there is no application 🙂 Here is the documentation: https://railpack.com/languages/staticfile
I see in the code of Caddyfile, that it says port:80 (https://github.com/railwayapp/railpack/blob/main/core/providers/staticfile/Caddyfile.template#L15), so maybe that one?
4 months ago
Something I'd try is using Cloudflare's DNS service as they automatically issue certs.
Also, IIRC you'd need to add both @ and www records if you're trying to use your root domain.
4 months ago
Then yes, use port 80.
I use port 80, but curl indicates that this setup does not work.
Regarding the Cloudflare's DNS — why? I think it's expected that railway will issue the certificate (documentation: https://docs.railway.com/guides/public-networking#custom-domains).
So I wrapped my website into fastify server and it started to work through curl. But no ssl certificate still.
Anyhow, I think it' not clear now how to attach custom domain to the static website. And it would be great if the documentation contains information how to do that.
4 months ago
Please link your service so I can take a look.
@Brody I already switched to the Node.js server wrapper.
But the setup was:
- Create /public/index.html
- Create Staticfile
- It deploys it using Caddy and it works fine on the railway domain
- When you try to attach your own, you need to enter the port and there is nothing there in the autocomplete. + it does not work with port 80.
4 months ago
Please link your service.
ok, execuse me I don know what link means in this context. But here are some uuids: https://railway.com/project/f279bb9e-59a0-41c8-830c-dd37fe2df64c/service/b6555db7-2e21-4f9a-8b74-6d2ef268aafa?environmentId=26b5d8e6-83dd-41f8-b7e3-eb3adcac31be .
3 months ago
I have the exact same issue. It appears docs are out of date with actual behavior. Some time in the past few months, a port is now required in the UI before a domain is made active.
Steps to reproduce:
- Create a GitHub repo with a file named index.html. Have some real HTML in there.
- Create a new railway project via GitHub Repository. Specify that repo.
- Docs say it's auto deployed. It's not. You have to trigger a deploy manually.
- After deployment, the site is not publicly accessible, there is no railway domain name used.
- Go to Settings, add a railway domain. Here you must specify a port. But there is no app. And the build logs/deploy logs/docs don't give you any indication of what is serving this static site up. Is it 3000, 80, 1234? Using 80 results in the "Application failed to respond" error page when visiting the railway domain.
So yes, out of the box, Railway static sites don't work. My test case is: /project/ab528235-05e4-413c-b787-1e65a805d09d/service/a1ebdbf8-055c-4e03-ace6-71aa939123e3/settings?environmentId=e3ccaeb4-d420-4eb2-acc6-8d3a32f01910 (I too don't know what "link your service" means)