Issue
- When a Content Delivery Network (CDN) is configured using the
cdn.host.httpandcdn.host.httpsproperties in theportal-ext.propertiesfile, the icons in the CKEditor 5 toolbar fail to load in Web Content articles. - The browser's developer console may show errors related to Cross-Origin Resource Sharing (CORS) policy, indicating that the browser is blocking requests to load SVG icon assets from the CDN's domain.
Environment
- Liferay 2026.Q1+
Resolution
The issue is caused by the browser's security policy preventing cross-origin requests for SVG spritemaps, which CKEditor 5 uses for its icons. When the portal is on one domain and the CDN is on another, the browser blocks the request unless the CDN is configured to allow it.
There are two primary architectural models for using a CDN with Liferay DXP:
- Model 1: CDN as a Reverse Proxy (Transparent)
- The site's DNS points to the CDN, and the CDN proxies all requests to the Liferay DXP instance. From the browser's perspective, all resources are served from the same domain.
- This model does not require
cdn.host.*properties and avoids CORS issues.
- Model 2: CDN as a Separate Origin (Explicit)
- The site's DNS points directly to the Liferay DXP instance. The
cdn.host.*properties are used to rewrite static asset URLs to point to the CDN domain. - This is the model that causes the cross-origin issue.
- The site's DNS points directly to the Liferay DXP instance. The
To resolve this, choose one of these solutions:
1. Configure CORS on the CDN (Recommended for Model 2)
- If you are using the separate origin model, you must configure your CDN (e.g., Amazon CloudFront) to include the correct CORS headers in its responses. This tells the browser that it is safe to load resources from the CDN domain.
- The CDN should send an
Access-Control-Allow-Originheader that includes your Liferay portal's domain. For example:Access-Control-Allow-Origin: https://your-portal-domain.com
- Configure the CDN behavior to allow
GET,HEAD, andOPTIONSHTTP methods, asOPTIONSis required for CORS preflight requests.
2. Switch to the Reverse Proxy Model (Recommended for New Setups)
- Reconfigure your architecture to use the CDN as a transparent reverse proxy (Model 1). In this setup:
- Point your site's public DNS record to the CDN.
- Configure the CDN to forward requests to your Liferay DXP instance as its origin.
- Remove the
cdn.host.httpandcdn.host.httpsproperties from yourportal-ext.propertiesfile.
- This approach simplifies the configuration and avoids cross-origin issues. Because the browser sees every resource coming from the same domain, it makes no cross-origin requests.