Skip to content
Advertisement

request IP in Laravel application not correct

in laravel when I want get visitor IP from request()->getClientIp() it always show my server IP and offcurse it not correct, I read about this problem I think it’s related to cloudflare and laravel TrustProxies but I don’t know what should I do.

how can I get real visitor IP address?

here is my $_Server dump

JavaScript

Advertisement

Answer

I found a solution for this problem, for fix the problem you should put * in TrustProxies Middleware

like this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement