change ip method header index in request object #35630
Answered
by
kohlerdominik
AliGhaleyan
asked this question in
General
-
i want to change the default index for get client ip when run: <?php
$request->ip(); default index for get ip from headers is |
Beta Was this translation helpful? Give feedback.
Answered by
kohlerdominik
Dec 20, 2020
Replies: 1 comment 1 reply
-
you should use TrustProxies middleware and add your trusted proxies there. Then, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
AliGhaleyan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you should use TrustProxies middleware and add your trusted proxies there.
https://laravel.com/docs/8.x/requests#configuring-trusted-proxies
Then,
$request->ip()
will return the correct ip.