Incorrect IP when in maintenance mode
Closed this issue · 3 comments
Laravel 5.5
Site is behind proxy
When using https://github.com/fideloper/TrustedProxy I get 2 different IP addresses
When the site is up, I get the correct IP inside a normal controller using $request->getClientip()
When I put the site into maintenence and look at the IP from https://github.com/MisterPhilip/maintenance-mode/blob/master/src/MisterPhilip/MaintenanceMode/Exemptions/IPWhitelist.php#L25 I get the proxy ip. I was expecting the same IP as $request->getClientip()
Hmm, what order are you loading the middleware in? Is the maintenance mode after the trusted proxy middleware?
That was it. Maintenance mode was before the trusted proxy Sorry, I should have caught that. Thanks for your help.
Now looks like this:
\App\Http\Middleware\TrustProxies::class,
\MisterPhilip\MaintenanceMode\Http\Middleware\CheckForMaintenanceMode::class,
For anyone else, they seem to work very well together (when loaded in the correct order). Just setup this package without proxy support i.e. 'exempt-ips-proxy' => false,
No problem, glad to hear it works with TrustedProxy without issues!!