Is there a guide for how to setup cloudflare tunnels with railway?

I'm trying to follow what is listed out here, but I'm failing to understand this guide. I've deployed a next.js project on a railway project, and I've also deployed the cloudflared template, setup the token in the cloudflared image, but I'm lost trying to point cloudflare to access my running next app.
Solution:
basically hard code the port, then specify the port of the next service in the service url
Jump to solution
30 Replies
Percy
Percy9mo ago
Project ID: f1e3ebf1-86f3-4db0-9fbe-72558c6f4423
Web Dev Cody
Web Dev CodyOP9mo ago
f1e3ebf1-86f3-4db0-9fbe-72558c6f4423
Web Dev Cody
Web Dev CodyOP9mo ago
No description
No description
Web Dev Cody
Web Dev CodyOP9mo ago
from what I understand, I needed to add a hostname to my cloudflare tunnel and use the internal networking hostname provided in railway? I've tried both http://webdevcody-com , https://webdevcody-com, and they full hostname
Web Dev Cody
Web Dev CodyOP9mo ago
I've verified my app is actually running by creating a public hostname here: https://webdevcodycom-production.up.railway.app/
Create Next App
Generated by create next app
Brody
Brody9mo ago
where is this screenshot from?
No description
Web Dev Cody
Web Dev CodyOP9mo ago
the cloudflare tunnel view
Web Dev Cody
Web Dev CodyOP9mo ago
No description
Web Dev Cody
Web Dev CodyOP9mo ago
on zero trust
Web Dev Cody
Web Dev CodyOP9mo ago
No description
Brody
Brody9mo ago
wow, look at the inconsistencies in the design, on the same page!! through me for a loop ill pull up my zero trust page and see how i have things setup screenshot of your tunnels page please? ill probably end up needing more screenshots as we go
Web Dev Cody
Web Dev CodyOP9mo ago
sure
Web Dev Cody
Web Dev CodyOP9mo ago
No description
Brody
Brody9mo ago
i know the second tunnel pertains to the topic of this help thread, but for context, whats the first tunnel for?
Web Dev Cody
Web Dev CodyOP9mo ago
another project I was going to set up before I decided not to break it I'll even delete that project planner tunnel just to make sure I didn't screw anything up I'm pretty sure I used 2 separate tokens
Brody
Brody9mo ago
okay can you send me your deploy logs for next https://bookmarklets.up.railway.app/log-downloader/
Web Dev Cody
Web Dev CodyOP9mo ago
No description
Web Dev Cody
Web Dev CodyOP9mo ago
that's all there is am I supposed to use http://localhost:5735 ?
Brody
Brody9mo ago
nope
Web Dev Cody
Web Dev CodyOP9mo ago
ah ok, didn't think so
Brody
Brody9mo ago
set a PORT service variable to 3000 on the next service, number doesnt matter too much, just need to be a fixed number so if you like 8080 more, use that instead
Web Dev Cody
Web Dev CodyOP9mo ago
sure
Brody
Brody9mo ago
and then another screenshot of the deploy logs please
Web Dev Cody
Web Dev CodyOP9mo ago
doing 3000, it's rebuilding now, might take a bit
Web Dev Cody
Web Dev CodyOP9mo ago
@Brody ^
No description
Web Dev Cody
Web Dev CodyOP9mo ago
No description
Web Dev Cody
Web Dev CodyOP9mo ago
ah you are a genius
Solution
Web Dev Cody
Web Dev Cody9mo ago
basically hard code the port, then specify the port of the next service in the service url
Web Dev Cody
Web Dev CodyOP9mo ago
it's working now, thank you so much for the help!
Brody
Brody9mo ago
yep exactly happy to help
Want results from more Discord servers?
Add your server