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

headersToInspect for CloudFlare driven sites #18

Closed lord-alfred closed 5 years ago

lord-alfred commented 6 years ago

https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-Cloudflare-handle-HTTP-Request-headers- + https://stackoverflow.com/questions/17540715/using-curl-i-added-the-header-http-x-real-ip-on-the-server-side-it-becomes-h

And I dont know, but current order in $headersToInspect maybe wrong.

akrabat commented 6 years ago

I'm unclear what problem you have and what the proposed solution is.

akrabat commented 5 years ago

Can you propose a specific thing that you want me to change that will solve your problem?

lord-alfred commented 5 years ago

If you use the wrong order of headers, then the first will be taken incorrect value for such sites (cloudflare driven).

lord-alfred commented 5 years ago

I use this order of headers:

        'CF-Connecting-IP',
        'True-Client-IP',
        'X-Real-IP',
        'Forwarded',
        'X-Forwarded-For',
        'X-Forwarded',
        'X-Cluster-Client-Ip',
        'Client-Ip',
akrabat commented 5 years ago

Thanks!