Skip to content

Instantly share code, notes, and snippets.

@gh640
Last active June 8, 2023 01:45
Show Gist options
  • Save gh640/aae7833415704777d47897dbd196ba96 to your computer and use it in GitHub Desktop.
Save gh640/aae7833415704777d47897dbd196ba96 to your computer and use it in GitHub Desktop.
Sample: Apache conf to ignore `internal dummy connection` in Docker image `php:8.0-apache`
# Exclude log records for internal dummy connections.
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog ${APACHE_LOG_DIR}/access.log combined env=!loopback
@gh640
Copy link
Author

gh640 commented Jun 8, 2023

Requests From the Server to Itself

When the Apache HTTP Server manages its child processes, it needs a way to wake up processes that are listening for new connections. To do this, it sends a simple HTTP request back to itself. This request will appear in the access_log file with the remote address set to the loop-back interface (typically 127.0.0.1 or ::1 if IPv6 is configured). If you log the User-Agent string (as in the combined log format), you will see the server signature followed by "(internal dummy connection)" on non-SSL servers. During certain periods you may see up to one such request for each httpd child process.

These requests are perfectly normal and you do not, in general, need to worry about them. They can simply be ignored.

If you wish to exclude them from your log, you can use normal conditional-logging techniques. For example, to omit all requests from the loopback interface from your logs, you can use

SetEnvIf Remote_Addr "127\.0\.0\.1" loopback

and then add env=!loopback to the end of your CustomLog directive.

In 2.2.6 and earlier, in certain configurations, these requests may hit a heavy-weight dynamic web page and cause unnecessary load on the server. You can avoid this by using mod_rewrite to respond with a redirect when accessed with that specific User-Agent or IP address.

InternalDummyConnection - HTTPD - Apache Software Foundation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment