oscarotero / psr7-middlewares

[DEPRECATED] Collection of PSR-7 middlewares
MIT License
668 stars 56 forks source link

Ip detect options #66

Closed wolfy-j closed 7 years ago

wolfy-j commented 7 years ago

Hi, i had a moment to work on #65

oscarotero commented 7 years ago

Thanks for your work, @wolfy-j but I'm not convinced about this change. All server parameter but REMOTE_ADDR can get from headers. For example, HTTP_X_FORWARDED_FOR can be taken from X-Forwarded-For header, so there's no need to handle servers parameters. The only exception is REMOTE_ADDR, that contains the ip of the TCP connection and it's something outside of any http header. more info.

I prefer an option called ->proxy(), that if it's true, use these proxy headers and let the REMOTE_ADDR as the final choice, instead the first. See, for example: https://github.com/akrabat/rka-ip-address-middleware

wolfy-j commented 7 years ago

Sure, i haven't work with ip detection for while, you can remove PR if it can be re-configured other way.

wolfy-j commented 7 years ago

Thought, server will usually duplicate ENV variables which might include ip address as well in environments where no correct header are set.

Overtorment commented 7 years ago

@wolfy-j not sure if thats relevant, improved IP detection (works with behind reverse proxies) was merged to master recently

wolfy-j commented 7 years ago

@Overtorment yeah, i'v already checked it and i like the outcome 👍