(Optional) Configure adaptive form cache at Dispatcher
You can also configure adaptive form caching at Dispatcher for an additional performance boost.
Pre-requisites
- Enable the merging or prefilling data at the client option. It helps merge unique data for each instance of a pre-filled form.
Considerations for caching adaptive forms on a Dispatcher
-
When using the adaptive forms cache, use the AEM Dispatcher to cache client libraries (CSS and JavaScript) of an adaptive form.
-
While developing custom components, on the server used for development, keep the adaptive forms cache disabled.
-
URLs without extension are not cached. For example, URL with pattern
/content/forms/[folder-structure]/[form-name].html
are cached and caching ignores URLs with pattern/content/dam/formsanddocument/[folder-name]/<form-name>/jcr:content
. So, use URLs with extensions to take the benefits of caching. -
Considerations for localized adaptive forms:
- Use URL format
http://host:port/content/forms/af/<afName>.<locale>.html
to request a localized version of an adaptive form instead ofhttp://host:port/content/forms/af/afName.html?afAcceptLang=<locale>
- Disable using browser locale for URLs with format
http://host:port/content/forms/af/<adaptivefName>.html
. - When you use URL Format
http://host:port/content/forms/af/<adaptivefName>.html
, and Use Browser Locale in configuration manager is disabled, the non-localized version of the adaptive form is served. The non-localized language is the language used while developing the adaptive form. The locale configured for your browser (browser locale) is not considered and a non-localized version of the adaptive form is served. - When you use URL Format
http://host:port/content/forms/af/<adaptivefName>.html
, and Use Browser Locale in configuration manager is enabled, a localized version of the adaptive form is served, if available. The language of the localized adaptive form is based on the locale configured for your browser (browser locale). It can lead to [caching only the first instance of an adaptive form]. To prevent the issue from happening on your instance, see troubleshooting.
- Use URL format
Enable the caching at Dispatcher
To enable and configure caching adaptive forms on Dispatcher, perform the following steps:
-
Open the following URL for every publish instance of your environment and enable flush agent for publish instances of your environment:
http://[server]:[port]]/etc/replication/agents.publish/flush.html
-
Add the following to your dispatcher.any file:
/invalidate { /0000 { /glob "*" /type "deny" } /0001 { # Consider all HTML files stale after an activation. /glob "*.html" /type "allow" } /0002 { # Exclude htmls present in AF directories /glob "/content/forms/**/*.html" /type "deny" }
When you add the above:
-
An adaptive form remains in the cache until an updated version of the form is not published.
-
When a newer version of a resource referenced in an adaptive form is published, the impacted adaptive forms is automatically invalidated. There are some exceptions to automatic invalidation of referenced resources. For workaround to exceptions, see the troubleshooting section.
-
-
Add the below rules dispatcher.any or custom rules file. It excludes the URLs that do not support caching. For example, Interactive Communication.
/0000 { /glob "*" /type "allow" } ## Do not cache csrf login tokens /0001 { /glob "/libs/granite/csrf/token.json" /type "deny" } ## Do not cache IC - print channel /0002 { /glob "/content/forms/**/channels/print.html" /type "deny" } ## Do not cache IC - web channel /0003 { /glob "/content/forms/**/channels/web.html" /type "deny" }
-
Add the following parameters to the ignore URL parameters list:
/ignoreUrlParams { /0001 { /glob "*" /type "deny" } # added for AEM forms specific use cases. /0003 { /glob "dataRef" /type "allow" } }
Your AEM environment is configured to cache adaptive forms. It caches all types of adaptive forms. If you require a check of user access permissions for a page before delivering the cached page, see caching secured content.
Troubleshooting
Some adaptive forms containing images or videos are not automatically invalidated from Dispatcher cache
Issue
When you select and add images or videos by way of asset browser to an adaptive form and these images and videos are edited in Assets editor, adaptive forms containing such images are not invalidated from Dispatcher cache automatically.
Solution
After publishing the images and video, explicitly unpublish and publish the adaptive forms that reference these assets.
Only the first instance of an adaptive form is cached
Issue
When the adaptive form URL does not have any localization information, and Use Browser Locale in the configuration manager is enabled, a localized version of the adaptive form is served. Only the first instance of the adaptive form is cached and delivered to every subsequent user.
Solution
Resolve the issue by performing the following steps:
-
Open the conf.d/httpd-dispatcher.conf or any other configuration file configured to load at runtime.
-
Add the following code to your file and save it. It is a sample code modify it to suit your environment.
<VirtualHost *:80>
# Set log level high during development / debugging and then turn it down to whatever is appropriate
LogLevel rewrite:trace6
# Start Rewrite Engine
RewriteEngine On
# Handle actual URL convention (just pass through)
RewriteRule "^/content/forms/af/(.*)[.](.*).html$" "/content/forms/af/$1.$2.html" [PT]
# Handle selector based redirection basded on browser language
# The Rewrite Cond(ition) is looking for the Accept-Lanague header and if found takes the first two character which most likely will be the desired language selector.
RewriteCond %{HTTP:Accept-Language} ^(..).*$ [NC]
RewriteRule "^/content/forms/af/(.*).html$" "/content/forms/af/$1.%1.html" [R]
</VirtualHost>
Experience Manager
Espressos & Experience Manager: AEM Forms
Espressos & Experience Manager
Thursday, Mar 6, 7:00 PM UTC
Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.
RegisterPut the Customer at the Center and Build Relationships That Last a Lifetime
First impressions last a lifetime. Great first impressions feel personal, connected, and relevant right from the start. From the first...
Wed, Mar 19, 2:30 PM PDT (9:30 PM UTC)
Elevate and Empower Teams with Agentic AI for Exceptional Experiences
Elevate and empower your CX teams with AI that transforms creativity, personalization, and productivity. Discover how Adobe is...
Tue, Mar 18, 1:00 PM PDT (8:00 PM UTC)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more