start page | rating of books | rating of authors | reviews | copyrights

Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

19.27. mod_proxy

The mod_proxy module handles a multitude of proxying and caching capabilities for the server. Proxies enforce security by screening and relaying requests made by a client; caches help to optimize transfer by storing recently requested information.

CacheDefaultExpire

CacheDefaultExpire time

[server config or within <VirtualHost>]

This sets the default expiry time, in hours, of a document in the cache, assuming an expiry has not already been set. The default is one hour. After the document has been expired, the client must refetch it directly from the server.

CacheDirLength

CacheDirLength length

[server config or within <VirtualHost>]

This directive sets the number of characters a directory can contain in the proxy cache.

CacheDirLength 1024768
CacheDirLevels

CacheDirLevels level

[server config or within <VirtualHost>]

This directive sets the number of subdirectories in the cache.

CacheDirLevels 10
CacheForceCompletion

CacheForceCompletion percentage

[server config or within <VirtualHost>]

This directive specifies the minimum percentage of a document required in order for it to be cached. This is useful in the event a document is canceled before completing a transfer. The default is 90 percent.

CacheGcInterval

CacheGcInterval time

[server config or within <VirtualHost>]

This directive instructs the server to garbage-collect the cache if the space usage is greater than the size specified by the CacheSize directive. The collection is performed every time hours. You can specify a noninteger for the time if you want to perform garbage collections between hours.

CacheLastModifiedFactor

CacheLastModifiedFactor factor

[server config or within <VirtualHost>]

This directive estimates an expiry date for a document by multiplying the factor specified by the time since the last modification. This is effective only if an expiry date for a document has not been set already. If the expiration date is greater than CacheMaxExpire, CacheMaxExpire is used instead.

CacheMaxExpire

CacheMaxExpire time

[server config or within <VirtualHost>]

This directive specifies the maximum amount of time a document should remain active. Once past this time, it is considered "expired" and should be reloaded directly from the server.

CacheRoot

CacheRoot directory

[server config or within <VirtualHost>]

This directive sets the name of the directory that will contain cache files.

CacheSize

CacheSize size

[server config or within <VirtualHost>]

This directive sets the maximum size, in kilobytes, of the cache. Once this size is exceeded, no more data is written to the cache.

NoCache

NoCache word|host|domain list

[server config or within <VirtualHost>]

This directive specifies a matching of documents that are not cached by the server. You can use one of three options:

word
The server searches for any such word in the title of the document. If one is found, the document is not cached.

host
A document that originates from the target host isn't cached.

domain list
Documents originating from any domain in the list are not cached.

For example:

NoCache abc.com def.com ghi.com
NoCache somecompany
NoCache *

Note that you are allowed to use wildcards. The last example forces the server not to cache any documents at all.

NoProxy

NoProxy domain|subnet|ip|hostname

[server config or within <VirtualHost>]

Specifies a list of intranet addresses or domains the proxy should not attempt to intermediate between. The parameter can be one of the following:

domain
A domain name, like .oreilly.com; hosts from the domain can bypass the proxy

hostname
A full hostname that can bypass the proxy

IP
An IP address of a host that can bypass the proxy

subnet
A subnet of addresses that can bypass the proxy

For example, the following disables the proxy for all addresses in the subnet 192.168:

NoProxy 192.168.0.0
ProxyBlock

ProxyBlock word|host|domain list

[server config or within <VirtualHost>]

Specifies a list of intranet addresses or domains which the proxy should block access to any documents on the server. The parameter can be one of the following:

word
The server searches for any such word in the title of the document. If one is found, the document is blocked.

host
A document that originates from the target host will be blocked.

domain list
Documents originating from any domain in the list are blocked.

For example, the following blocks all requests for documents from dirtyrotten.com and hackers.com:

ProxyBlock dirtyrotten.com hackers.com
ProxyDomain

ProxyDomain domain

[server config or within <VirtualHost>]

This directive specifies the default domain of the proxy. For example:

ProxyDomain .oreilly.com
ProxyPass

ProxyPass path url

[server config or within <VirtualHost>]

This directive translates requests for a specific path to be redirected to the corresponding url. This allows remote servers to act as if they existed in the local filesystem. Note that this directive takes place regardless of whether the ProxyRequests directive is activated. For example:

ProxyPass /mydir http://www.otherserver.com/mydir
ProxyPassReverse

ProxyPassReverse path url

[server config or within <VirtualHost>]

Handles redirects made by a server pointed to by the ProxyPass directive by modifying the Location header in the HTTP redirect response. This directive alters redirect references to a specific path to the corresponding url.

ProxyReceiveBufferSize

ProxyReceiveBufferSize bytes

[server config or within <VirtualHost>]

Specifies the networking buffer size for outgoing connections through the proxy. The value must be greater than 512. However, you can use the value 0 to indicate that the system's default buffer size should be used. For example:

ProxyReceiveBufferSize 4096
ProxyRemote

ProxyRemote match remote-server

[server config or within <VirtualHost>]

This directive specifies a remote proxy that should be used under user-definable conditions. The match parameter is either a URL scheme (http, ftp, etc.) that the server supports, or a partial URL which should be redirected to the remote proxy. The remote-server parameter should be organized as a fully qualified URL, as shown below:

ProxyRemote ftp http://ftpproxy.oreilly.com:8080
ProxyRemote * http://handle.everything.oreilly.com:9001

Currently, http is the only scheme supported for the remote-server parameter.

ProxyRequests

ProxyRequests on|off

[server config or within <VirtualHost>]

This directive activates or deactivates proxy serving. The default is:

ProxyRequests Off

Note that even though proxy requests are deactivated, the ProxyPass directives are still valid.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.