akrabat / ip-address-middleware

PSR-7 Middleware that determines the client IP address and stores it as an ServerRequest attribute
Other
168 stars 37 forks source link

Missing support for the header 'Forwarded' (rfc 7239) #2

Closed gboily closed 6 years ago

gboily commented 8 years ago

Headers 'X-Forwarded-*' seem to have been standardized in rfc 7239 (June 2014). Useful infos on wikipedia : https://en.wikipedia.org/wiki/X-Forwarded-For

The standardized header name is 'Forwarded'.

Syntax example : Forwarded: for=192.0.2.60; proto=http; by=203.0.113.43

akrabat commented 8 years ago

Would love to see a PR for this.

gboily commented 8 years ago

Here it is : pull request https://github.com/akrabat/rka-ip-address-middleware/pull/3

pine3ree commented 7 years ago

Hello @akrabat,

I cannot find a reference for an 'X-Forwarded' http header field anywhere.

This RFC article (https://tools.ietf.org/html/rfc7239#page-4) speaks about the X-Forwarded class of fields (X-Forwarded-For, X-Forwarded-Proto,X-Forwarded-Host) and the proposal of grouping them into a single 'Forwarded' header.

maybe it would be better to drop support for X-Forwarded and replace it with 'Forward' (testing the 1st for=IP; part)

kind regards