For every request we look if the X-FORWARDED-FOR header is set and use that, falling back to the http.Request.RemoteAddr field if the header isn't set.
We then add that address to the log for the request.
Testing
requests with curl. Both with and without the X-FORWARDED-FOR header.
This PR addresses the following issues:
https://github.com/ImageWare/TLSential/issues/64
Approach
For every request we look if the
X-FORWARDED-FOR
header is set and use that, falling back to thehttp.Request.RemoteAddr
field if the header isn't set. We then add that address to the log for the request.Testing
requests with curl. Both with and without the
X-FORWARDED-FOR
header.