Forum Moderators: open
Accept-Encoding: br,gzip
Referrer: https://www.google.com/
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Did you spot it? foreach (getallheaders() as $name => $value)
{
fwrite($fh, "$name: $value\n");
}
Frankly I’m surprised that _I_ homed in on it as fast as I did. Some days, I might have stared blankly at it for hours. if a given client sends an item in the Request Header, such as "Referrer", that it would not be logged because it doesn't show up in the above listExactly. Bear in mind that in some respects computers are vastly dumber than humans, and thus don’t recognize the concept of misspelling.
45.38.206.abc - - [24/May/2025:23:49:22 -0700] "GET /ebooks/beauty/beauty1.html HTTP/1.1" 403 3466 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 OPR/117.0.0."
Complete logged headers for the same request (exemplified): 2025-05-24:23:49:22
URL: /ebooks/beauty/beauty1.html
Status: 403
HTTPS: on
IP: 45.38.206.abc
----
Content-Length: 0
Connection: close
Host: example.com
Accept-Encoding: br,gzip
Referrer: https://www.google.com/
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 OPR/117.0.0.
----
botheader: Referrer
lying_bot: Chrome/132.0.0.0
----
My logheaders code is attached to all pages including error documents, so I can always tell why they’re blocked. (If you wondered, “lying_bot” doesn’t necessarily mean a lying robot, though in this case it certainly does. I use it when determining which version of robots.txt to serve.) "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""(literal quotation marks are escaped because the whole pattern is in quotes), which translates as: the "forwarded for" or "X-forwarded for" fieldI've got one that says
SetEnvIf X-Forwarded-For ^(unknown|\W) botheader=XForward
:: detour here to disentangle cat toy from robotic vacuum ::