My app is hosted on AWS Fargate, behind a load balancer. All incoming requests have the IP of this load balancer. It stores the original IP in the "X-Forwarded-For" header. Laravel can retrieve that easily.
I'm using the database driver for the auth session, and I noticed that it stores the IP address. If that IP address was correct, it would be very useful to me for other purposes.
So the question is: how can I customize the code that manages the session, so that instead of storing request()->ip()
, it stores request()->header('X-Forwarded-For')
?
Thank you