Closed kingIZZZY closed 6 months ago
Thanks, - great point.
I'm whipping something up to resolve that.
I'll merge in https://github.com/fly-apps/laravel-docker/pull/9 soon
Two notes:
1️⃣ The log format created is this (modified from the default combined
log format):
log_format fly '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$forwarded_header_value"';
Which means the client IP will be last in the log string.
2️⃣ I'm re-building the Docker images now so this update makes it to Docker Hub, that'll take a few minutes.
Would it make sense to put the fly-client-ip at the beginning and maybe add the remote_addr at the end? In this context of a docker project specifically made for fly.io it would seem the remote_addr is guaranteed to always be some boring internal fly.io ip address, and the actual interesting IP address which we are most interested to see at the beginning of log lines is the fly-client-ip, no?
I don't want to stray far from the standard combined
log format, the format used here is like the 2nd most common log format (appending x-forwarded-for
or similar after the combined
log format stuff content), so in that sense I'd rather not do more.
I see Arguably this "most common format" also most commonly displays the most commonly desired IP address - the actual client IP and not the fly.io-specific IP.. 🤔 just my 2cents
How about - is there any way to open this up to be configured from the Dockerfile? So by default it can be configured as you implemented, but in the Dockerfile there can be some line to conveniently modify this log_format particularly for fly.io users as mentioned because of the "real IP" issue specific to such fly.io projects
nginx access log prints the internal IP address for each request All requests in the access log output appear to come from the same origin IP address - which is only the fly router internal IP 🤦♂️ Can it please be configured to print the correct IP address whether Fly-Client-IP or X-Forwarded-For or whatever it needs to be 🙏
Example:
All access log entries have the same exact IP address no matter where the request comes from