Native OSGi integration for AEM 6.5 and AEMaaCS.
The aem-edge-csp-plugin.ui.apps package installs a Sling SAX Transformer that automatically
attaches nonce="CF_EDGE_NONCE" to every script and style tag during AEM publish rendering —
keeping your Dispatcher cache hit ratio at 100%. Register your domain to get instant download access.
Unlike generic CDN scripts, EdgeNonce natively integrates into AEM's core Apache Sling rendering pipeline, preparing your HTML to be processed by your Cloudflare Worker service at https://edge-nonce.com.
Our Java OSGi bundle registers `com.adobe.aem.edge.csp.rewriter.EdgeCspTransformerFactory`. As Apache Sling renders AEM page components and Client Libraries (`/etc.clientlibs/`), our SAX transformer intercepts open tag events (`startElement`) in real time and attaches the static placeholder attribute (`nonce="CF_EDGE_NONCE"`).
On AEM Author instances (`localhost:4502`), Content Authors edit pages without a CDN in front. Our transformer inspects `WCMMode`: if `EDIT` or `PREVIEW`, it dynamically generates a live 16-character random nonce on the Java JVM so authoring previews work seamlessly without CDN interception!
Managed via AEM OSGi Console (`com.adobe.aem.edge.csp.config.EdgeCspSiteService`). Enterprise administrators can configure factory definitions for distinct brand hierarchies (`/content/wknd/us` vs `/content/portal`) with custom placeholder tokens.
Template developers can inject nonces into custom inline HTL scripts using our Sling Model helper (`EdgeCspModel`). All packages pass Jackrabbit FileVault validation (`mvn clean package`), guaranteeing zero deployment failures in Adobe Cloud Manager pipelines!
Because EdgeNonce decouples HTML rendering from cryptographic nonce injection, our architecture operates cleanly across all historical and modern AEM deployment models:
Interprets Sling SAX events before Apache 2.4 Dispatcher disk caching. Preserves 100% on-prem static cache files.
Passes automated Jackrabbit FileVault validation in Cloud Manager CI/CD pipelines. Compatible with Adobe Fastly CDN.
Zero-code modification required. Edge compute worker injects nonces dynamically into document-based HTML output.
Injects dynamic nonces into React / Angular SPA boot bundles and attaches real-time Content-Security-Policy headers.
Choose the installation method that best matches your enterprise development workflow:
Add the bundle as a sub-module dependency inside your parent AEM project's `all/pom.xml` package:
Build locally using Maven and deploy directly to your local AEM Author instance (`localhost:4502`):
Commit the plugin module to your Adobe Cloud Manager Git repository branch and run a Full Stack Deployment:
Strict Content-Security-Policy completely blocks inline event handlers (onclick) and inline styles (style=""). For older AEM JSP or HTL components that rely heavily on inline JavaScript, we provide a client-side compatibility delegator (csp-compat.js).
How to use: Simply include <script src="https://edge-nonce.com/assets/js/csp-compat.js"></script> in your AEM page header. The script automatically executes on load, scans the DOM for data-evt-* and data-style attributes, and securely attaches the JavaScript events and CSS values dynamically without violating the Strict CSP.
Follow each step to configure the EdgeNonce AEM plugin for your project. Your progress is saved automatically.
aem-edge-csp-plugin.zip and confirm the JAR contentsDownload the plugin ZIP from the button above or directly from the URL below. Verify it contains the required OSGi bundle JAR before proceeding.
https://edge-nonce.com/download/aem-edge-csp-plugin.zip
Once downloaded, unzip and confirm the structure:
ui.apps CRX packagecore OSGi bundle JARChoose the installation method that matches your project workflow. All three produce the same result.
http://localhost:4502/crx/packmgr in your browseraem-edge-csp-plugin.ui.apps-1.0.0.ziphttp://localhost:4502/crx/packmgr
mvn clean install -PautoInstallPackage -Daem.host=localhost -Daem.port=4502
For AEM Publish on port 4503, change -Daem.port=4503. Repeat for each AEM instance.
git add . && git commit -m "feat: add EdgeNonce CSP OSGi plugin" && git push origin main
Fill in your project details and click Generate Config. The plugin reads this OSGi factory config to know which AEM content path to protect.
Save this file to your project at the path shown below, then commit and deploy:
ui.config/.../com.adobe.aem.edge.csp.config.EdgeCspSiteService-myproject.cfg.json
Contents shown above
Open the Felix OSGi Web Console on your AEM instance and confirm all three components are in Active state.
http://localhost:4502/system/console/components
Search for EdgeCsp — you should see:
com.adobe.aem.edge.csp.rewriter.EdgeCspTransformerFactory — Activecom.adobe.aem.edge.csp.config.EdgeCspSiteRegistry — Activecom.adobe.aem.edge.csp.config.EdgeCspSiteService — Active (one per site config)Also verify the Sling Rewriter pipeline includes edgecsp:
http://localhost:4502/system/console/configMgr → Search "RewriterPipeline"
curl -u admin:admin "http://localhost:4502/system/console/bundles/com.adobe.aem.edge.csp.core.json"
nonce="CF_EDGE_NONCE" appears on published HTMLRun these checks on both AEM Publish (should show static placeholder) and through your Cloudflare Worker (should show a real nonce).
① AEM Publish — verify placeholder is present:
curl -s "http://localhost:4503/content/YOUR-SITE/en/home.html" | grep 'nonce='
② Through Cloudflare Worker — verify real nonce is injected:
curl -sI "https://YOUR-SITE.com/en/home.html" | grep -i "content-security-policy"
③ AEM Author — verify live random nonce on edit pages:
These steps are only needed if your AEM components use inline onclick/style="" attributes or have custom inline <script> blocks in HTL templates.
① Add csp-compat.js to your AEM Client Library (clientlib):
<script src="https://edge-nonce.com/assets/js/csp-compat.prod.js" nonce="CF_EDGE_NONCE"></script>
② Replace inline handlers in legacy JSP/HTL components:
③ Custom inline scripts in HTL — use EdgeCspModel: