ashcrow / flask-track-usage

Basic metrics tracking for the Flask framework.
Other
53 stars 33 forks source link

Include X-Forwarded-For as well as remote_addr #20

Closed ashcrow closed 9 years ago

ashcrow commented 9 years ago

Created from #16

"Since it is easy to forge an X-Forwarded-For field the given information should be used with care. The last IP address is always the IP address that connects to the last proxy, which means it is the most reliable source of information. X-Forwarded-For data can be used in a forward or reverse proxy scenario.

Just logging the X-Forwarded-For field is not always enough as the last proxy IP address in a chain is not contained within the X-Forwarded-For field, it is in the actual IP header. A web server should log BOTH the request's source IP address and the X-Forwarded-For field information for completeness."

Why not log both instead of guessing? Would love to hear feedback on this.

ashcrow commented 9 years ago

Done in PR #16.