Last active
April 18, 2024 16:32
-
-
Save 4lun/913d0288b0fdc4a31810b436d1c62017 to your computer and use it in GitHub Desktop.
Get access logs on DigitalOcean App Platform (with PHP via heroku-php-apache2) logging the forwarded Client IP by default on the "Runtime Logs" tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update run_command in app spec to pass config, e.g. `run_command: heroku-php-apache2 -C apache_app.conf public/` | |
DirectoryIndex index.php index.html index.htm | |
# mod_remoteip should be loaded by default, but needs configuration | |
RemoteIPHeader DO-Connecting-IP | |
# Trust any private IPv4 ranges | |
RemoteIPTrustedProxy 10.0.0.0/8 | |
RemoteIPTrustedProxy 172.16.0.0/12 | |
# We need to update the LogFormat, substituting %h with %a (have also added %V to include Host/CanonicalName) | |
# - Default value: LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" heroku | |
# - From https://github.com/heroku/heroku-buildpack-php/blob/1adf23f08e17bdd8cf034c04bebfef1c55474810/conf/apache2/heroku.conf#L23 | |
LogFormat "%a %l %u %t %V \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" heroku |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment