R
Railway12mo ago
macwilko

Cloudflare load balancing between regions

I'm trying to setup a cloudflare loadbalancer to route traffic by location between different services on Railway (EU and US-West). I'm having some problems configuring it, I'de really appreciate any help!!
No description
No description
197 Replies
Percy
Percy12mo ago
Project ID: dd3f96f7-3ab3-4453-86a3-32328b2f81d6
macwilko
macwilkoOP12mo ago
dd3f96f7-3ab3-4453-86a3-32328b2f81d6 When I try resolve the root domain I get:
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
so I have the load balancer setup now, and it thinks the origin servers are healthy
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
Feels like it might be a TLS error I occasionally see this page then this page
macwilko
macwilkoOP12mo ago
No description
Brody
Brody12mo ago
railway uses the host to know what service to route traffic to, so it sees wikid.app and doesn't know where to send it to, somehow you'd need to get cloudflare to set the host to whatever origin it decides to proxy to
macwilko
macwilkoOP12mo ago
brody!! thankyou so this is the little bit confusing thing let me show you
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
in the load balancer, it is configured for the domain wikid.app it has two origins configured, one for eu, one for us I tried configuring it for railway generated domains, and it seems to kinda work
Brody
Brody12mo ago
I don't even know if what I said is possible in cloudflare, I only know thats why it doesn't work
macwilko
macwilkoOP12mo ago
yeah.. it's strange it seems like the service in railway needs to be configured to respond to wikid.app but this shouldn't be needed since cloudflare should be responsible for the routing to services
Brody
Brody12mo ago
I have only ever seen a host mask option with fastly and that was not with a load balancer
macwilko
macwilkoOP12mo ago
is it possible to ask the team on monday if this is possible with railway? cloudflare load balancing across regions
Brody
Brody12mo ago
it is possible, one way or another, they even mention it in the docs
macwilko
macwilkoOP12mo ago
sweet ok that's promising
Brody
Brody12mo ago
that also means you'd need to provide your own certs for wikid.app, since railway isn't in charge of that domain anymore
macwilko
macwilkoOP12mo ago
i see, i believe cloudflare can also do this right?
Brody
Brody12mo ago
I honestly don't know
macwilko
macwilkoOP12mo ago
i know i'm kinda poking at the extremes of what's possible here with railway but it would be so nice to have eu / us regions working
Brody
Brody12mo ago
haha no you're not, if cloudflare has a way to issue a cert for your domain and set the host to the upstream domain then you'd be done by now
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
No description
Brody
Brody12mo ago
to install on your server is not applicable here
macwilko
macwilkoOP12mo ago
yeah >.< that's what's confusing, i thought cloudflare was already sorta doing this
Brody
Brody12mo ago
1. railway isn't your server 2. cloudflare is the server now that they're doing the lb
macwilko
macwilkoOP12mo ago
right exactly but i just need to route traffic to railway the load balancer i think normally takes an IP or a hostname but it doesn't seem like railway router supports this setup it doesn't know how to handle it
Brody
Brody12mo ago
try with Fastly, they let you set conditions and you also should be able to set the host
macwilko
macwilkoOP12mo ago
damn, i'd like to try get it to work with cloudflare since I'm using alot of their products. It's also not clear to me if fastly would work either
Brody
Brody12mo ago
well keep messing around with cloudflare then, but with fastly you can write your own logic
No description
macwilko
macwilkoOP12mo ago
i can't see how that's different to cloudflare
Brody
Brody12mo ago
can you write logic like that in cloudflare?
macwilko
macwilkoOP12mo ago
i could show you in VC maybe?
Brody
Brody12mo ago
I don't like VC
macwilko
macwilkoOP12mo ago
ahh i remember lol
Brody
Brody12mo ago
but you now know your two blockers, so play around some
macwilko
macwilkoOP12mo ago
damn, well. idk honestly. I'm lost on that
Brody
Brody12mo ago
try to solve it the same way I would, google stuff and run around in the cloudflare dashboard
macwilko
macwilkoOP12mo ago
fair. I'll give it another shot. Although, I personally think the things I have tried, leads me to believe this isn't possible yet the clue for me this this bit:
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
configuring the domain wikid.app in railway shouldn't be required
Brody
Brody12mo ago
I'm not sure if I'd even be able to test something like this, I don't subscribe to any vpn services so that I could switch regions
macwilko
macwilkoOP12mo ago
but it seems like it is currently i'm seeing all the traffic routed to US servers
Brody
Brody12mo ago
to get an ssl cert it's required, but like I said you need to provide your own cert since railway is no longer going to be the one routing traffic railway is not going to have anything to do with the root domain wikid.app for what you want
macwilko
macwilkoOP12mo ago
no 😦 i don't think fastly or cloudflare can help it's a limitation of railway router
Brody
Brody12mo ago
you're giving up too easily and worst of all you're blaming railway
LaCrak27
LaCrak2712mo ago
just found this null lmao
No description
LaCrak27
LaCrak2712mo ago
but mac, there has to be a way even if its slightly janky lma
macwilko
macwilkoOP12mo ago
^.^
Brody
Brody12mo ago
someone give me their login to a vpn provider already
LaCrak27
LaCrak2712mo ago
Don't lose HOPE!
macwilko
macwilkoOP12mo ago
proton has a free vpn
LaCrak27
LaCrak2712mo ago
i use tunnelbear for free for sus things
macwilko
macwilkoOP12mo ago
hehe
LaCrak27
LaCrak2712mo ago
the free 2 gigs are enough (monthly)
Brody
Brody12mo ago
gross
macwilko
macwilkoOP12mo ago
but you don't need a vpn for this lol 😄
LaCrak27
LaCrak2712mo ago
? oh fuck i just realized what you thought i don't mean stuff like porn
macwilko
macwilkoOP12mo ago
ahaha
LaCrak27
LaCrak2712mo ago
with sus things
macwilko
macwilkoOP12mo ago
like... netflix
Brody
Brody12mo ago
how would I test region routing if I can't make a request from a different region
LaCrak27
LaCrak2712mo ago
i mean like tryna get access to bard while being in spain and under 18 kinda sus things
macwilko
macwilkoOP12mo ago
at least in cloudflare you can set the proximity via a map:
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
you could drag this map and route all US traffic to the EU origin lol if you wanted
LaCrak27
LaCrak2712mo ago
i can one hundred percent see a company accidentally running like that and not noticing
macwilko
macwilkoOP12mo ago
hehe yeah... ! boss, our latency just jumped 200%! no idea why...
LaCrak27
LaCrak2712mo ago
lmfao fr
Brody
Brody12mo ago
that's not how you'd have it actually setup in the end so I wouldn't do that myself
macwilko
macwilkoOP12mo ago
fair proton vpn is pretty solid and free
Brody
Brody12mo ago
is their free version gonna ask me to upgrade every minute
macwilko
macwilkoOP12mo ago
nope i've used it for years, never paid
Brody
Brody12mo ago
can I put a subdomain in cloudflare without having to setup the nameservers
macwilko
macwilkoOP12mo ago
i beleive for cloudflare to work, you need to configure the name servers so cloudflare can proxy requests right? on wikid.app that was the first step I needed to do for configuring cloudflare
Brody
Brody12mo ago
so if i wanted to test region lb with cloudflare id need another domain, i only own one and im not changing the nameservers on it
LaCrak27
LaCrak2712mo ago
i can let you test a domain
macwilko
macwilkoOP12mo ago
oof. I mean you're welcome to play around with my cloudflare account
LaCrak27
LaCrak2712mo ago
just bought it yesterday and i have no use for it whatsoever (for now)
Brody
Brody12mo ago
is it a sus domain
macwilko
macwilkoOP12mo ago
israsist .com
Brody
Brody12mo ago
me omw to check mod log to see if you said something worse before you said that
macwilko
macwilkoOP12mo ago
LOL anyways no rush on this 😒 it's about to be christmas, and it's your birthday brody lol... i wasn't expecting this to be solved today tbh
LaCrak27
LaCrak2712mo ago
nope, omnibot.es i think
Brody
Brody12mo ago
what are its current nameservers
LaCrak27
LaCrak2712mo ago
or was it .com... i have no idea just bought it and it is .es should be nominalia's ones
LaCrak27
LaCrak2712mo ago
No description
LaCrak27
LaCrak2712mo ago
why is there an ftp subdomain lmfao
No description
LaCrak27
LaCrak2712mo ago
@Brody
Brody
Brody12mo ago
hmmm now could i just add that to my cloudflare account?
LaCrak27
LaCrak2712mo ago
hold up lemme get brodyiscool.online and give that to you xd bc i will use this one this xmas
Brody
Brody12mo ago
lmao dont go buying a domain for this
LaCrak27
LaCrak2712mo ago
its free for me like a weird offer but if you promise to give it back after youre done you can use that one
Brody
Brody12mo ago
i mean ofc but i think id only be giving you nameservers to set on it, we arent doing a domain transfer
macwilko
macwilkoOP12mo ago
i have a domain we can do that on wilko.dev
LaCrak27
LaCrak2712mo ago
oh if its only that we can do it or even better on mac's one whichever one you choose :)
macwilko
macwilkoOP12mo ago
ty lacrak, you're awesome buddy send me NS
LaCrak27
LaCrak2712mo ago
you mean that to brody right? btw please don't take this to DMs, i wanna see how this is done incase i do need to use railway for something like this one day
Brody
Brody12mo ago
ill go with mac's domain getting ns now
kanye.ns.cloudflare.com
tricia.ns.cloudflare.com
kanye.ns.cloudflare.com
tricia.ns.cloudflare.com
macwilko
macwilkoOP12mo ago
ok
LaCrak27
LaCrak2712mo ago
very interesting nameservers
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
should be done!
LaCrak27
LaCrak2712mo ago
actually if you point 2 domains to the exact same nameservers they just act as one right? or does the ssl cert freak out...
Brody
Brody12mo ago
no clue
Brody
Brody12mo ago
not impressed
No description
LaCrak27
LaCrak2712mo ago
LMAO
macwilko
macwilkoOP12mo ago
no way how comes mine is free then?
LaCrak27
LaCrak2712mo ago
tunnelbear is still free
Brody
Brody12mo ago
mine is free, it just wants me to upgrade
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
ahh
LaCrak27
LaCrak2712mo ago
and i haven't noticed any push to upgrade
Brody
Brody12mo ago
did you just leak your ip lmao
LaCrak27
LaCrak2712mo ago
eh just replug router its fine :)
macwilko
macwilkoOP12mo ago
if this works
Brody
Brody12mo ago
nah just press the renew button in your routers settings
No description
macwilko
macwilkoOP12mo ago
i bet you wikid app will have the fastest api, on railway no joke
LaCrak27
LaCrak2712mo ago
(inb4 2940ms latency)
macwilko
macwilkoOP12mo ago
hehe
LaCrak27
LaCrak2712mo ago
(i'm joking dw) i mean if i end up working with you that would become my problem lmfoa
macwilko
macwilkoOP12mo ago
brody i can send you my CF credentials if that helps you won't have a load balancer without $15 >.<
Brody
Brody12mo ago
no i think the nameservers are sufficent, im just setting up the two region services right now
macwilko
macwilkoOP12mo ago
i see ok
Brody
Brody12mo ago
oh, then yeah id need the creds if it isnt on free
macwilko
macwilkoOP12mo ago
right, one sec, will DM you those
LaCrak27
LaCrak2712mo ago
can i have em too 😳
Brody
Brody12mo ago
ive removed wilko.dev from my account, go ahead and add that to your own cloudflare account context: i now have access to his account
macwilko
macwilkoOP12mo ago
sweet
macwilko
macwilkoOP12mo ago
you should see wikid.app then goto Traffic I think on the left
Brody
Brody12mo ago
and it comes with dark mode on, how thoughtfull
macwilko
macwilkoOP12mo ago
there's a section for Argo and Load balancers
Brody
Brody12mo ago
erm
No description
macwilko
macwilkoOP12mo ago
ooo you need access to anythign else?
Brody
Brody12mo ago
haha no, i have pro, it was just missing with the new ui
macwilko
macwilkoOP12mo ago
oh lol
Brody
Brody12mo ago
im going to get the basics working before i touch wikid.app
https://region-eu.up.railway.app/
https://region-as.up.railway.app/
https://region-eu.up.railway.app/
https://region-as.up.railway.app/
macwilko
macwilkoOP12mo ago
alright 🙂 🤞
Brody
Brody12mo ago
oh for me to add wilko.dev youd need to pay again lol
macwilko
macwilkoOP12mo ago
just fiddle with wikid app 😄
Brody
Brody12mo ago
doesnt matter if i mess something up?
macwilko
macwilkoOP12mo ago
nobody's gonna mind if it goes down nah, it's a toy project atm, not even released yet i've removed wikid.app domain from my Railway project
Brody
Brody12mo ago
ill just be digging around the ui for a bit
macwilko
macwilkoOP12mo ago
no worries you can get lost in cloudflare lol so many settings starting to feel like AWS console
Brody
Brody12mo ago
proton not gonna work, need something else unless its just the chrome extension
macwilko
macwilkoOP12mo ago
hmm maybe I can hit the end point for you? i'm in europe where should i visit? ooo
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
is it working?
Brody
Brody12mo ago
visit from singapore
macwilko
macwilkoOP12mo ago
wikid.app is resolving to a EU railway from my location that's ... promising !! ok
Brody
Brody12mo ago
its the fallback pool so dont get excited
macwilko
macwilkoOP12mo ago
i will goto singapore one sec wow
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
i think you did it AS
Brody
Brody12mo ago
and you where ready to give up lol
macwilko
macwilkoOP12mo ago
O.O how tf did you do that
Brody
Brody12mo ago
im built diff
macwilko
macwilkoOP12mo ago
yeah. please explain what you did lol
Brody
Brody12mo ago
well you see... i took my own advice
macwilko
macwilkoOP12mo ago
O.O idk personally I think you're just pretty good at the networking stuff it's not my skill, i'm happy to own that lol
Brody
Brody12mo ago
most literally, exactly what i said
No description
LaCrak27
LaCrak2712mo ago
lmao nice
macwilko
macwilkoOP12mo ago
oo its the host header?
LaCrak27
LaCrak2712mo ago
ay
No description
macwilko
macwilkoOP12mo ago
honestly i would of never guessed that not in a million years
LaCrak27
LaCrak2712mo ago
he did tell you tho lmfao
Brody
Brody12mo ago
was right from the very start
macwilko
macwilkoOP12mo ago
also.. i'm bad at reading argh i see >.< yeah... mb can i play around with cloudflare now brody? ;-D i wanna configure wikids regions for it
Brody
Brody12mo ago
go for it
Brody
Brody12mo ago
service groups is perfect for this kind of thing
No description
macwilko
macwilkoOP12mo ago
ooo i'm gonna try it!! man it's not obvious how to enable that trying to figure that out lol
Medim
Medim12mo ago
This entire thread made into a portfolio blog post would be super cool nice tutorial here
Brody
Brody12mo ago
maybe
macwilko
macwilkoOP12mo ago
^.^ could be... something cool
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
how do you like group them together with the coloured background? i can move them around but i can't seem to colour them
Brody
Brody12mo ago
right click on the service
macwilko
macwilkoOP12mo ago
ooo got it damn
Brody
Brody12mo ago
or just on the canvas, I forgot
macwilko
macwilkoOP12mo ago
No description
macwilko
macwilkoOP12mo ago
bro ok i just need to get the planetscale database hooked up
LaCrak27
LaCrak2712mo ago
ay that looks nice as hell how expensive is it to run tho 💀 can't be cheap at all
macwilko
macwilkoOP12mo ago
i think must be about $100/m i think database / cloudflare / railway
LaCrak27
LaCrak2712mo ago
DAMn
Medim
Medim12mo ago
imo that's fairly priced considering all that infra thonk
macwilko
macwilkoOP12mo ago
yeah totally i'm not complaining i think most of the bill is on cloudflare stuff tbh
Brody
Brody12mo ago
thank you for the trains!!! ❤️
macwilko
macwilkoOP12mo ago
you deserve way more.
Brody
Brody12mo ago
awe thank you
Dmitry
Dmitry12mo ago
Brody helping other people on his birthday 😭 You're the best!
Brody
Brody12mo ago
yeah and I'll be here on Christmas too
Dmitry
Dmitry12mo ago
You're too good to us 😩
LaCrak27
LaCrak2712mo ago
i will also be snoopin in here lmao
Want results from more Discord servers?
Add your server