Blacklisting ip from accessing the server
Hello, I want to only let specific ip access the server. How can I do that using railway?
22 Replies
Project ID:
N/A
N/A
good name
hahaha
but that's something your app would have to do itself, there's no railway firewall
Im hosting the server for sending POST requests only but i only want specific addresses to be able to do that
that's something your app would have filter itself, there's no railway firewall
Do you know if thats possible using java springboot? sorry im kind of new to this
code up a middleware for it, have the middleware only pass requests if the requests come from a local IP address (so railway itself can healthcheck your app) or the single IP that you have whitelisted, it's a few if statements, nothing complicated
make sure you are reading the real ip addresses from the
X-Forwarded-For
headerwhat do you mean?
can't explain it any better than that
what is the x forwarded for header?
that question can be answered with a quick Google search
youre right
okay thanks for your help i think i got it from here, make a file filtering the ip and only pass the requests if the ip matches
you'll need to allow local ip's or else railway might think your app is dead
By allowing local ips, do you mean adding 127.0.0.1 to the whitelist or do i need to do additional steps?
192.168.0.0/16
10.0.0.0/8
127.0.0.1
use cidr ranges to check the incoming ip against
i am unfamiliar with working with this, but from what i understand, i need to allow the ranges 192.168.0.0/16 ,10.0.0.0/8,
127.0.0.1, as well as the ip addresses i am whitelisting in my program
correct
Everything seems to be working as intended. Thank you so much for your help.
no problem!
would personally suggest using cloudflare for access firewalls and etc, esp for ranges