Edge Delivery Services how-tos · updated
How to add custom HTTP response headers (like CORS) in Edge Delivery Services
Custom response headers are set in the headers object of the site configuration, keyed by a URL glob such as /fragments/**, for example to allow cross-origin requests. aem.live warns that access-control-allow-origin: * can expose preview and live sites to CSRF attacks against authors logged in through Sidekick. Restrict it to one origin and as few URLs as possible.
How the configuration looks
Each key is a glob pattern on the URL path; * works as a prefix or suffix and ** matches deep paths, as in /foo/** or **/bar/**. Each value is a list of key and value pairs for the headers. aem.live also offers an HTTP Headers Editor.
When changes apply
Headers apply to both preview and live. For content, caches are purged automatically and the change is immediate. For code resources, the header applies after the next code sync, either a push to main or a manual resync through the Admin API.
| Need | Pattern | Header |
|---|---|---|
| Let one partner site fetch fragments | /fragments/** | access-control-allow-origin: https://partner.example.com |
| Cache a JSON feed briefly | /feeds/** | A cache-control value your CDN honours |
| Don't do | /** | access-control-allow-origin: * |
Headers set at your own CDN (BYO CDN) are a separate layer; keep a single source of truth so the two don't conflict.
Site configuration headers (from aem.live's example)
{
"/fragments/**": [
{ "key": "access-control-allow-origin", "value": "https://www.example.com" }
]
}How to do it
- Decide which paths need the header and which origin should be allowed.
- Add the glob and header to the site configuration (or the HTTP Headers Editor).
- For code resources, trigger a code sync.
- Test with curl -I on .page and .live.
Related pages on this site
Questions
Is access-control-allow-origin: * safe on EDS?
aem.live warns it may make preview and live sites vulnerable to CSRF against authors logged in via Sidekick. Allow a specific origin and limit the paths.
Do header changes apply to preview too?
Yes, to both preview and live.
Why hasn't my header appeared on a JS file?
Headers on code resources apply after the next code sync.
Sources
- aem.live: Custom HTTP Response Headers (checked 10 Nov 2026)
Facts about Adobe's platform are from the linked Adobe pages, checked 10 Nov 2026. Explanations and examples are ours unless marked as Adobe's.