static website + custom domain
pavelpolyakov
HOBBYOP

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?

$10 Bounty

12 Replies

Your port will depend on what port your application is listening to.


pavelpolyakov
HOBBYOP

4 months ago

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?


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.


Then yes, use port 80.


pavelpolyakov
HOBBYOP

4 months ago

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).


pavelpolyakov
HOBBYOP

4 months ago

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.


pavelpolyakov
HOBBYOP

4 months ago

@Brody I already switched to the Node.js server wrapper.

But the setup was:

  1. Create /public/index.html
  2. Create Staticfile
  3. It deploys it using Caddy and it works fine on the railway domain
  4. 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.


pavelpolyakov
HOBBYOP

4 months ago


Anonymous
PRO

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)


3 months ago

There is an app, there is always an app, most likely port 8080.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...