Skip to content

CORS Errors on Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode)

Preconditions and Environment

Magento Version: 2.4.6-p7
Web Server: Nginx
PHP Version: 8.2
Page Builder Extension: Enabled
Store Mode: Production (issue occurs only in this mode)

Steps to Reproduce

Log in to the Magento 2 Admin panel.
Navigate to Content > Pages.
Click on Add New Page or select an existing CMS page and click Edit.
Use the Page Builder to add a new content block or edit an existing block.
Make any changes to the content (e.g., adding text, images, or other elements).
Click the Save button to update the page.

Expected Result

The page content should be saved successfully without any errors.
Actual Result

The Page Builder changes fail to save.
The browser console logs CORS-related errors, specifically showing:

Cross-Origin Request Blocked: The Same Origin Policy disallows
reading the remote resource at
https://domain.com/static/adminhtml/Magento/backend/en_US/requirejs/require.js.
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status
code: 200.

Additional Information

This problem occurs only in production mode, the Page Builder works fine in developer mode.

Workarounds Attempted

- Applied quality patches ACSD-49628 and ACSD-59514, and deployed the production environment, but the issue persists.
- Added CORS headers to Nginx configuration.
- Cleared caches (both browser and Magento).

If you have any suggestions or know of a solution, please let me know. Thank you!