Skip to content

AEM Dispatcher Filter Rules: the /filter Section and Content-Disposition

How AEM Dispatcher filter rules work: /type, path, selectors, regex, rule order, Cloud Service default filters, testing, and the Content-Disposition filter.

Written in November 2026 for AEM as a Cloud Service and AEM 6.5. Checked against Adobe's Dispatcher configuration and Cloud Service Dispatcher documentation, the AEM project archetype's dispatcher module, and the Apache Sling Security source.

On this page
  1. Which property must every filter rule have?
  2. Glob, wildcards or regular expressions?
  3. Why does the order of filter rules matter?
  4. Where do the filter rules live in AEM as a Cloud Service?
  5. How do you write your own filter rules?
  6. How do you test Dispatcher filter rules?
  7. What is Content-Disposition, and why does AEM change it?

Dispatcher filter rules are the /filter section of a Dispatcher farm: an ordered list of numbered rules, each marked allow or deny, that decides which requests reach AEM publish. A rule matches part of the request (its URL, path, selectors, extension, method or query string), and when several rules match, the last one wins. A denied request gets a 404. The safe pattern is the one Adobe's own defaults use: deny everything in the first rule, then open only what the site serves.

/filter {
  /0001 { /type "deny"  /url "*" }
  /0002 { /type "allow" /method "GET" /path "/content/mysite/*" /extension '(html|json|jpg|png|svg)' }
  /0003 { /type "deny"  /selectors '(infinity|tidy|query|sysview|docview)' }
}

Rule names such as /0001 only need to be unique. Their numbers don't set the order; the position in the file does.

Which property must every filter rule have?

/type. It's the only property that says what the rule does, and it takes "allow" or "deny". Every rule also needs at least one pattern to match against, picked from these:

PropertyMatchesExample value
/methodHTTP method"GET", '(GET|HEAD)'
/urlthe whole URL path, with selectors and extension"/etc.clientlibs/*"
/querythe query string; a rule with it matches only requests that have one"wcmmode=*"
/protocolthe protocol on the request line"HTTP/1.1"
/paththe resource path, before the first dot"/content/mysite/*"
/selectorsthe selectors"model"
/extensionthe extension"json"
/suffixthe suffix after the extension"/2026/*"
/globthe entire request line (deprecated)"GET /content/* HTTP/1.1"

/path, /selectors, /extension and /suffix split the URL the way Sling does. For /content/mysite/en/news.model.json/2026/11 that gives the path /content/mysite/en/news, the selector model, the extension json and the suffix /2026/11. Matching these pieces is safer than one wildcard on /url, because /url "/content/*.json" would also match news.infinity.json.

Glob, wildcards or regular expressions?

A double-quoted value is a wildcard pattern: * matches any run of characters. A single-quoted value is a POSIX extended regular expression, so '(css|js|png)' means one of three extensions. Put a regular expression in double quotes and Dispatcher reads the parentheses and pipes as literal characters, so the rule matches nothing you meant.

/glob is a different thing. It matches the whole request line, spaces and protocol included, and filtering with it is deprecated. A rule may use /glob or the element properties, never both. On AEM as a Cloud Service the Dispatcher validator refuses allow rules written with /glob as insecure (CVE-2016-0957), so a configuration that worked on an old 6.x farm can fail the cloud build until those rules are rewritten:

# old style, rejected by the Cloud Service validator
/0041 { /type "allow" /glob "* /content/mysite/*.html *" }

# same intent with element properties
/0041 { /type "allow" /method "GET" /path "/content/mysite/*" /extension "html" }

Why does the order of filter rules matter?

Because the last matching rule wins, the deny-all rule goes first and the narrow denials go after the broad allows. Reverse the last two rules of the first example and /content/mysite/en.infinity.json is served again, because the allow for /content/mysite/* with json now comes later and wins.

It also means a rule you add at the end can reopen something an earlier rule closed. On AEM as a Cloud Service your rules are appended after Adobe's defaults, so an allow in your file overrides any default deny it matches. Write allows as narrowly as the feature needs: method, path, selector and extension together.

Where do the filter rules live in AEM as a Cloud Service?

In the dispatcher module of the project, under src/conf.dispatcher.d/filters/. The farm file includes filters.any, and the archetype's filters.any starts by including Adobe's defaults:

# conf.dispatcher.d/available_farms/default.farm (excerpt)
/filter {
  $include "../filters/filters.any"
}

# conf.dispatcher.d/filters/filters.any
$include "./default_filters.any"

# Allow components JSON model
/0101 { /type "allow" /extension "json" /selectors "model" /path "/content/*" }

# Allow manifest.webmanifest files located in the content
/0102 { /type "allow" /extension "webmanifest" /path "/content/*/manifest" }

default_filters.any is one of the immutable files. You can read it, but edits to it are ignored in the cloud and the immutability check fails, so every change goes into filters.any. In outline, the defaults:

  • deny everything (/aem0001);
  • allow requests under /content/* with page, script, style, image, font, PDF and video extensions, including html, svg and pdf;
  • allow GET for static file extensions on any path, and GET on /etc.clientlibs/*;
  • allow the CSRF token, POSTs to /content/*.form.html, Sling sitemap selectors, POST and OPTIONS on the GraphQL endpoints, GET, POST and OPTIONS on persisted queries, and the Content Fragment Delivery API;
  • deny the selectors that dump content, such as infinity, tidy, query, sysview, docview and numeric depths, with json, xml, html or feed;
  • deny any GET with a debug= or wcmmode= query parameter.

Plain JSON under /content isn't in that list, which is why the archetype adds the model rule. /crx, /system, /apps and /bin appear in the file only as commented-out lines.

How do you write your own filter rules?

Add them to filters.any below the include, numbered so they don't collide with Adobe's /aemNNNN names. Common cases:

# a GET-only JSON servlet registered at /bin/mysite/search
/0110 { /type "allow" /method "GET" /path "/bin/mysite/search" /extension "json" }

# a component JSON export with its own selector, under one site only
/0111 { /type "allow" /method "GET" /path "/content/mysite/*" /selectors "productlist" /extension "json" }

# robots.txt, after a rewrite rule maps /robots.txt into /content
/0112 { /type "allow" /method "GET" /path "/content/mysite/robots" /extension "txt" }

Filters see the URL after Apache's rewrite rules have run, so a short public URL such as /robots.txt is allowed by its repository path. The rewrite half is in mapping /robots.txt to a repository path, and pages use the same mapping when you hide /content from URLs. If you build a GraphQL client that sends GET requests to the endpoint itself (persisted queries are already allowed), that GET needs its own rule too.

Adobe's Dispatcher documentation also says to purge the cache whenever the filter rules change, so plan a flush with every filter deployment.

How do you test Dispatcher filter rules?

For AEM as a Cloud Service, the Dispatcher tools in the AEM SDK run the same checks as the Cloud Manager pipeline. validate.sh runs the validator, then httpd -t, then confirms the immutable files are untouched:

./bin/validate.sh src/dispatcher

# start Apache and Dispatcher in Docker in front of a local publish on 4503
./bin/docker_run.sh src/dispatcher host.docker.internal:4503 8080

Besides the /glob check, the validator flags rules that expose admin features such as /crx/de or /system/console. Then send requests to the local container and check the status codes. Anything that should be blocked must come back 404:

for u in /system/console /crx/de/index.jsp \
         /content/mysite/en.infinity.json /content/mysite/en.tidy.json \
         "/content/mysite/en.html?wcmmode=disabled" /content/mysite/en.html; do
  printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:8080$u")" "$u"
done

When a rule doesn't behave, raise DISP_LOG_LEVEL in the local container. Trace logging shows which filter intercepted a request; in the cloud the Dispatcher log stops at debug, so do this work locally. On a cloud environment, download or tail the aemdispatcher log from Cloud Manager.

On AEM 6.5 the filter sits in the farm inside dispatcher.any (or a file it includes). The rule syntax is the same, there's no validator, and Adobe's own sample section starts with the same deny-all rule.

What is Content-Disposition, and why does AEM change it?

Content-Disposition is the response header that tells the browser whether to show a file in the window (inline) or download it (attachment). AEM sets it to attachment on purpose for binaries, as a defense against XSS through SVG files: an SVG uploaded to the DAM can carry script, and opened inline it would run on your site's origin. The side effect: a PDF link downloads when the business wants it to open in a tab.

The Sling Content Disposition Filter (AEM 6.5)

On AEM 6.5 the header comes from the Apache Sling Content Disposition Filter, PID org.apache.sling.security.impl.ContentDispositionFilter. It acts only on GET and HEAD requests for resources that hold a binary, meaning a jcr:data or jcr:content/jcr:data property, and it never touches pages. It has three properties:

PropertyConsole labelMeaning
sling.content.disposition.pathsIncluded Resource Paths & Content TypesEntries of the form path:type,type. The path is absolute and may end in *; the listed MIME types are served inline on that path.
sling.content.disposition.excluded.pathsExcluded Resource PathsExact paths left alone. No wildcards.
sling.content.disposition.all.pathsEnable For All Resource Pathstrue covers every path except the excluded ones, and the path list is then ignored.

This configuration lets PDFs and raster images open inline anywhere under the DAM, keeps every other binary type (SVG and HTML included) as a download, and exempts one known-safe SVG:

File ui.config/src/main/content/jcr_root/apps/mysite/osgiconfig/config.publish/org.apache.sling.security.impl.ContentDispositionFilter.cfg.json:

{
  "sling.content.disposition.paths": [
    "/content/dam/*:application/pdf,image/jpeg,image/png,image/gif,image/webp"
  ],
  "sling.content.disposition.excluded.paths": [
    "/content/dam/mysite/brand/logo.svg"
  ],
  "sling.content.disposition.all.paths": false
}

Leave image/svg+xml and text/html off the inline list unless only trusted people can upload to that folder. Adding them reopens exactly the hole the filter closes.

Content-Disposition on AEM as a Cloud Service

On the publish tier of AEM as a Cloud Service, binaries are served as attachments by default, and Adobe documents the override in the Dispatcher's Apache configuration. This vhost snippet opens DAM PDFs inline:

<LocationMatch "^\/content\/dam.*\.(pdf).*">
  Header unset Content-Disposition
  Header set Content-Disposition inline
</LocationMatch>

Keep the pattern as tight as the file types you trust. One more detail applies to both platforms: the archetype's farm lists Content-Disposition in the cache's /headers section, so a file served from the Dispatcher cache keeps the header AEM sent. Remove it from that list and cached PDFs lose their disposition after the first request.

More in Operations, SEO and upgrades