3

I have a site at a big hosting company and I checked the apache log generated by the site and I saw requests like this in it:

"GET hostname/~username/proj/favicon.ico HTTP/1.1"

Where hostname is the hostname of the site, username is my username at the hosting company, and proj is the directory where the site is hosted.

What surprises me is that the request shows the actual directory structure instead of the actual request ("GET hostname/favicon.ico HTTP/1.1"). Is this normal? Shouldn't it show the actual HTTP request, instead of this translated request path?

I find it strange that the actual HTTP request does not appear in the log at all. Surely, the browsers don't know my username and the project directory at the hosting company, so it can't be the actual HTTP request what the client made.

  • +1: interesting question which will likely help future visitors. – William Edwards Oct 18 '14 at 19:50
1

LogFormat and similar

Apache and other major players in the web service space generally will allow customisation to access and error logs. The access log of "GET hostname/~username/proj/favicon.ico HTTP/1.1" is normal and working as intended, it is happening because your host is using LogFormat to output a log more to their liking.

In this case its most likely something like:

LogFormat "%h %l %u %t %v \"%r\" %>s %b \"%{User-agent}i\""

%h is the name of the hostname, %u is username and the other options do other things that you can find out more about LogFormat on Apache Module mod_log_config official help page. If you dislike their log files then you can setup a cron job that will copy the log file and then find and replace the parts you dislike, most web hosts allow cron jobs and if your with a good one then you should also have SSH access what makes it even easier.

  • In the apache documentation examples %r generates a request line like this: "GET /apache_pb.gif HTTP/1.0". It does not contain a path, so they don't use %r in my case. I wonder what flag they use instead of %r which generates this request line. – Tom Oct 19 '14 at 5:57
  • Sorry but that is an example, not an exact example of what they actually use. Your should ask them its a lot easier than going through all the flags :) – Simon Hayter Oct 19 '14 at 11:35
  • Okay. I tried the reuqest line in the log file and it also works accessing the page, so I guess they do use %r, but they translate (route) the request internally to my hosting directory and that's why this request appears in the log. – Tom Oct 19 '14 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.