Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to understand how the communication works between the browser and the server in the case of custom error message.

I understand a 301/302 header which contains the URL of the page in question,

HTTP/1.1 30x ....
Location: http://www.example.org/

but the 404 header does not (as far as I can see).

What tells the browser to go get the error page? I do not have a network sniffer and the question itself generates a huge amount of noise on google

Here is what I see when I trace http:

GET http: //myserver.com/unknownpage HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-gb
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive
Host: myserver.com
Cookie: ...

HTTP/1.1 404 Not Found
Date: Wed, 30 Jan 2013 08:54:52 GMT
Server: Apache
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Proxy-Connection: Keep-Alive
Connection: Keep-Alive


GET http: //myserver.com/errorpages/error404.htm HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-gb
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive
Host: myserver.com
Pragma: no-cache
Cookie: ...

HTTP/1.1 200 OK
Date: Wed, 30 Jan 2013 08:54:52 GMT
Server: Apache
Last-Modified: Tue, 22 Jan 2013 16:14:07 GMT
Accept-Ranges: bytes
Content-Type: text/html
Content-Length: 5958
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 0

So my question is what exactly tells the browser to go fetch the custom page? I know how to set it up on Apache, my question is about the communication only

share|improve this question
    
That sequence of requests and responses doesn't make any sense. The first GET indicates a proxied request that is pulled from another web server by the first one. The second one has an extra space in it which would result in a 400 Bad Request response. The requests are also missing a Host: header, which is not optional in HTTP/1.1 requests and would have also caused a 400 Bad Request response. Maybe you can edit your question and replace them with the actual requests and responses? –  Ladadadada Jan 30 '13 at 10:12
    
See update - the trace is from ieHTTPHeaders –  mplungjan Jan 30 '13 at 10:25
    
Have you got a different tool you can collect the requests and responses with? Chrome, Firebug (for Firefox), curl (with --include) or tcpdump/Wireshark would all work. The above request and response still don't make any sense and since the tool you are currently using is known to mangle the results in strange ways, I would suggest abandoning it. –  Ladadadada Jan 30 '13 at 10:47
    
In chrome's network tab I just see the error page, not the 404 itself. –  mplungjan Jan 30 '13 at 12:24

1 Answer 1

The web server simply returns the configured page to the browser when configured to do so for each specific HTTP error code.

You are actually replacing the default page served in case of specific error with your custom one.

share|improve this answer
    
I understand what the end result is. But I see a GET after the 404 header. –  mplungjan Jan 30 '13 at 10:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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