# Builtin Filters

## baseurlfilter

The baseurlfilter changes the base url of a request. It is useful for running CherryPy behind Apache with mod_rewrite.

The baseurlfilter has the following configuration options

- baseUrlFilter.baseUrl
- baseUrlFilter.useXForwardedHost

## cachefilter

## decodingfilter

The decoding filter can be configured to automatically decode incoming requests.

The decodingfilter has the following configuration options:

- decodingFilter.encoding

## encodingfilter

The encodingfilter can be configured to automatically encode outgoing responses.

The encodingfilter has the following configuration options:

- encodingFilter.encoding
- encodingFilter.mimeTypeList

## gzipfilter

The gzipfilter will automatically gzip outgoing requests, if it is supported by the client.

The gzipfilter does not have any configuration options.

## logdebuginfofilter

The logdebuinfofilter adds debug information to each page. The filter is automatically turned on when "server.environment" is set to "development".

The logdebuginfofilter has the following configuration options:

logDebugInfoFilter.mimeTypeList, ['text/html']

logDebugInfoFilter.logAsComment, False

logDebugInfoFilter.logBuildTime, True

logDebugInfoFilter.logPageSize, True

## staticfilter

The static filter allows CherryPy to serve static files.

The staticfilter has the following configuration options:

- staticFilter.file
- staticFilter.dir

- staticFilter.root

## nsgmlsfilter

## tidyfilter

The tidyfilter cleans up returned html by running the response through Tidy.

Note that we use the standalone Tidy tool rather than the python mxTidy module. This is because this module doesn't seem to be stable and it crashes on some HTML pages (which means that the server would also crash.)

The tidyfilter has the following configuration options:

- tidyFilter.tmpDir
- tidyFilter.strictXml, False
- tidyFilter.tidyPath
- encodingFilter.errorsToIgnore, []

## virtualhostfilter

The virtualhostfilter changes the ObjectPath based on the Host. Use this filter when running multiple sites within one CP server.

The virtualhostfilter has the following configuration options:

- virtualHostFilter.prefix, '/'

## xmlrpcfilter

The xmlrpcfilter converts XMLRPC to the CherryPy2 object system and vice-versa.

PLEASE NOTE: beforeRequestBody: Unmarshalls the posted data to a methodname and parameters. - These are stored in cherrypy.request.rpcMethod and .rpcParams - The method is also stored in cherrypy.request.path, so CP2 will find the right method to call for you, based on the root's position. beforeFinalize: Marshalls cherrypy.response.body to xmlrpc. - Until resolved: cherrypy.response.body must be a python source string; this string is 'eval'ed to return the results. This will be resolved in the future. - Content-Type and Content-Length are set according to the new (marshalled) data

The xmlrpcfilter does not have any configuration options.

## sessionauthenticatefilter

## sessionfilter

The Session Filter has its own section