R
Railway•9mo ago
~/qudo

Setup Cloudflare Proxy

1. Clicked "custom domain". 2. Railway pops up a CNAME for me to add to Cloudflare. 3. Add CNAME record to Cloudflare. 4. Railway says "Cloudflare proxy detected" indicating it knows about the DNS change. 5. Test out domain and its dead, returns a 522. 6. Go back to Railway and test if generating a domain works. 7. It does. Generated domains work, so I know the app is serving correctly. Railway says it detects cloudflare DNS but Cloudflare is giving me 522s.
32 Replies
Percy
Percy•9mo ago
Project ID: N/A
Brody
Brody•9mo ago
can you send the custom and railway domain in question?
~/qudo
~/qudoOP•9mo ago
I am trying this pattern with a few projects but here's one of he broken ones. Broken https://rulabs.dev/ Works rulabs-production.up.railway.app
~/qudo
~/qudoOP•9mo ago
No description
Brody
Brody•9mo ago
what kind of app is that?
~/qudo
~/qudoOP•9mo ago
Static site
~/qudo
~/qudoOP•9mo ago
No description
~/qudo
~/qudoOP•9mo ago
React app
Brody
Brody•9mo ago
create react app?
~/qudo
~/qudoOP•9mo ago
No, was generated with NX, but its just a vite react app, static site in the end
~/qudo
~/qudoOP•9mo ago
No description
No description
Brody
Brody•9mo ago
okay vite, cool. i suspect theres something going wrong with http-server, can we get you setup with a proper http server like caddy?
~/qudo
~/qudoOP•9mo ago
ah, ok, i'll try that out then maybe i can use railway static here?
Brody
Brody•9mo ago
would you want to add me to your repo so i can figure out to integrate my pre-existing caddy solution? nope, it can not serve SPA apps
~/qudo
~/qudoOP•9mo ago
yeah happy to, this is kinda a sandbox experiment so you can't break anything. i moved a few of our apps to this monorepo to test. see the package.json on how to build stuff. lmk your gh
Brody
Brody•9mo ago
brody192
~/qudo
~/qudoOP•9mo ago
huh weird, some error about org seats. I made it public for a bit https://github.com/ru-labs/rulabs
GitHub
GitHub - ru-labs/rulabs
Contribute to ru-labs/rulabs development by creating an account on GitHub.
Brody
Brody•9mo ago
i assume you have build:the76devs and start:the76devs set in the service settings on railway?
~/qudo
~/qudoOP•9mo ago
yep! previously i was trying with npx nx build the76devs but railway threw errors at that so i only made the package scripts to get past that
~/qudo
~/qudoOP•9mo ago
which idk why, this other app i have from another repo works fine
No description
Brody
Brody•9mo ago
cool, ill see about doing a pr that will integrate caddy
~/qudo
~/qudoOP•9mo ago
No description
~/qudo
~/qudoOP•9mo ago
sweet thanks! and curious to see if there will be much extra to do when adding more apps in the future
Brody
Brody•9mo ago
ill try to make it as non intrusive as possible for the changes in the PR to work you just need to add a NIXPACKS_CONFIG_FILE service variable set to apps/the76devs/nixpacks.toml on the "the76devs" service, and the same variable set to apps/rulabs/nixpacks.toml on the "rulabs" service. as far as i can tell, everything else can stay the same. PR: https://github.com/ru-labs/rulabs/pull/1 test sites with cloudflare proxies: https://the76devs.railyard.link/ and https://rulabs.railyard.link/
~/qudo
~/qudoOP•9mo ago
very cool! will play with this when home. Since all apps in this monorepo follow the same pattern I wonder if there's a way to share the same config every app will/should be built to dist/apps/appname but i can play with that. thanks again
Brody
Brody•9mo ago
no problem!
~/qudo
~/qudoOP•9mo ago
just thought of something. i could probably use caddy to host a spa and make it ignore hashrouting huh 👀 sometimes i have those like small 2 route apps that would be just fine like that
Brody
Brody•9mo ago
why do you need to ignore hash routing?
~/qudo
~/qudoOP•9mo ago
cleaner urls, can then do a URL + a hash while still only having client side app. There's some things with history you lose when using hash routes too i think. its a more rare case for sure. more so just wanted to try it out
Brody
Brody•9mo ago
why not do just regular page routing?
~/qudo
~/qudoOP•9mo ago
your change worked! or was a part of the puzzle. after the change i was getting "too many redirects", and had to change my cloudflare ssl settings from "flexible" to "full".
Want results from more Discord servers?
Add your server