Trusting proxy IP

Apparently there is some custom header that could be use the get the real client IP and cannot be spoofed (X-Envoy-External-Address or X-Real-Ip ?) Sounds like I cannot trust those custom headers with Laravel https://laravel.com/docs/11.x/requests. Is there some proxy IP that could be trusted ?
Solution:
X-Real-Ip is the header you trust as long as you arent running behind another proxy (cloudflare) https://utilities.up.railway.app/raw...
Jump to solution
12 Replies
Percy
Percy5d ago
Project ID: N/A
Quentin
Quentin5d ago
N/A
Solution
Brody
Brody5d ago
X-Real-Ip is the header you trust as long as you arent running behind another proxy (cloudflare) https://utilities.up.railway.app/raw
Quentin
Quentin5d ago
Unfortunately it sounds like you cannot trust this header (which is railway specific I guess ?) with Laravel
No description
Brody
Brody5d ago
its not railway specific in the slightest X-Forwarded-For can also be trusted, as long as the right most value is used
Quentin
Quentin5d ago
Ok, thank you. Is it guarantee that the container be accessed directory ? So I could basiclly trust the IP sent in the TCP packets (that should be the proxy IP) ?
Brody
Brody5d ago
you can't access the application without first going through the http proxy
Quentin
Quentin5d ago
With Laravel this should be the way :
No description
Quentin
Quentin5d ago
(not sure if I can change the title to be more Laravel specific)
Brody
Brody5d ago
make sure you are only trusting the right most value of that header
Quentin
Quentin5d ago
It only trust the IP that is making the request as a proxy. If the container can't be reached from outside it's fine. Thank you !
Brody
Brody5d ago
I think you are misunderstanding, users can set that header and then your application will receive a list of IPs instead of a single value
Want results from more Discord servers?
Add your server