> For the complete documentation index, see [llms.txt](https://commandbox.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://commandbox.ortusbooks.com/embedded-server/multi-site-support/servlet-pass-predicate.md).

# Servlet Pass Predicate

In a traditional server setup, you are used to two separate pieces of software

* A web server like NGinx, Apache, or IIS which serves static files, performs URL rewrites, and proxies some requests off to a servlet
* A Servlet container like Tomcat or CommandBox receiving the proxied requests on another port (HTTP or AJP) and processing CF code

In CommandBox, now we have the ability to combine both of those bullets together into a single piece of software. No reverse proxy is needed, nor is a second port to proxy to.

In all cases with the legacy setup, there is always a check of some kind that decides which requests will get sent to the servlet. This is usually checking for URLs ending in `.cfm` or `.cfc`. Common implementations of this are:

* Adobe's CF connector
* The mod\_cfml module for Apache
* BonCode for IIS
* A custom proxy directive in your web server.

As of CommandBox 6, we have the same setting and it can be set as `web.servletPassPredicate` which is simply an [Undertow Predicate](/embedded-server/configuring-your-server/server-rules.md). By default, CommandBox uses the following predicate for the `servletPassPredicate`:

```javascript
regex( '^/(.+?\\.cf[cms])(/.*)?$' ) or regex( '^/(.+?\\.bx[sm]{0,1})(/.*)?$' )
```

So the URI `/index.cfm` will get sent to the servlet, but `/test.txt` would just get sent by the static file resource handler. You can customize this if necessary with any valid Undertow predicate. It can even be different on a per-site basis by setting it inside the `sites` object or `.site.json` file for a given site.

```bash
# Send ALL traffic to the servlet (the servlet's default handler will serve static files)
server set web.servletPassPredicate=true

# Only serve CF files out of the cgi folder
server set web.servletPassPredicate="regex( '^/cgi/(.+?\\.cf[cms])(/.*)?$' )"

# process CFM files or anything in the /REST/ directory
server set web.servletPassPredicate="regex( '^/(.+?\\.cf[cms])(/.*)?$' ) or regex( '^/(.+?\\.bx[sm]{0,1})(/.*)?$' ) or path-prefix-nocase( /REST/ )"
```

Note, be careful as your servlet pass setting may send `.cfm` files to the static file handler. CommandBox has a [failsafe in place](/embedded-server/configuring-your-server/server-rules/allowed-static-files.md) to prevent the source code from being returned, but you should still use caution when configuring this.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://commandbox.ortusbooks.com/embedded-server/multi-site-support/servlet-pass-predicate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
