Since most web servers returns quite crappy error pages and it is often wanted to be able to show a uniform view to the user, trapping error pages in the accelerator and replace the error message with a custom one is very handy.
This is done by detecting HTTP error codes (and Squid error codes) and when detected, request a new error message body from a external URL.
Example:
error_map http://your.web.server/error/404.html 404
This causes 404 errors to be trapped, and the error message from http://your.web.server/error/404.html to be displayed rather than the original error message from the server.
The request sent for the error message is a GET request with the following special HTTP headers:
In addition the following client headers are forwarded:
And the following server headers:
The reply send to the client has the HTTP headers of the original error message (except for Content-Length), and a reply body from the specified URL.