- publishing free software manuals
The Apache HTTP Server Reference Manual
by Apache Software Foundation
Paperback (6"x9"), 862 pages
ISBN 9781906966034
RRP £19.95 ($29.95)

Get a printed copy>>>

19.4  Examples

19.4.1  Changing protocol behavior with misbehaving clients

Earlier versions recommended that the following lines be included in httpd.conf to deal with known client problems. Since the affected clients are no longer seen in the wild, this configuration is likely no-longer necessary.

# The following directives modify normal HTTP response  
# behavior. The first directive disables keepalive for  
# Netscape 2.x and browsers that spoof it. There are  
# known problems with these browser implementations.  
# The second directive is for Microsoft Internet  
# Explorer 4.0b2 which has a broken HTTP/1.1  
# implementation and does not properly support  
# keepalive when it is used on 301 or 302 (redirect)  
# responses.  
BrowserMatch "Mozilla/2" nokeepalive  
BrowserMatch "MSIE 4\.0b2;" nokeepalive  
             downgrade-1.0 force-response-1.0  
# The following directive disables HTTP/1.1 responses  
# to browsers which are in violation of the HTTP/1.0  
# spec by not being able to grok a basic 1.1 response.  
BrowserMatch "RealPlayer 4\.0" force-response-1.0  
BrowserMatch "Java/1\.0" force-response-1.0  
BrowserMatch "JDK/1\.0" force-response-1.0

19.4.2  Do not log requests for images in the access log

This example keeps requests for images from appearing in the access log. It can be easily modified to prevent logging of particular directories, or to prevent logging of requests coming from particular hosts.

SetEnvIf Request_URI \.gif image-request
SetEnvIf Request_URI \.jpg image-request
SetEnvIf Request_URI \.png image-request
CustomLog logs/access_log common env=!image-request

19.4.3  Prevent "Image Theft"

This example shows how to keep people not on your server from using images on your server as inline-images on their pages. This is not a recommended configuration, but it can work in limited circumstances. We assume that all your images are in a directory called /web/images.

SetEnvIf Referer "^http://www\.example\.com/" local_referal # Allow browsers that do not send Referer info SetEnvIf Referer "^$" local_referal <Directory /web/images>

Order Deny,Allow
Deny from all
Allow from env=local_referal


For more information about this technique, see the "Keeping Your Images from Adorning Other Sites2 " tutorial on ServerWatch.

ISBN 9781906966034The Apache HTTP Server Reference ManualSee the print edition