Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.4.5-p12] CORS Errors Prevent Page Builder Content Updates (Production Mode) #39250

Closed
5 tasks
anasshl opened this issue Oct 10, 2024 · 16 comments
Closed
5 tasks
Labels
Area: Content Component: PageBuilder Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Progress: PR Created Indicates that Pull Request has been created to fix issue Reported on 2.4.6-p7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@anasshl
Copy link

anasshl commented Oct 10, 2024

Preconditions and environment

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).

Quality Patches:

  • The issue persists even after applying quality patches ACSD-49628 and ACSD-59514.

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

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

We have attempted the following workarounds without success:

  • We have applied quality patches ACSD-49628 and ACSD-59514, and we deployed the production environment .but the issue persists.
  • Adding CORS headers to Nginx configuration.
  • Clearing caches (both browser and Magento).

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Oct 10, 2024

Hi @anasshl. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

Copy link

m2-assistant bot commented Oct 10, 2024

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.6-p7 Indicates original Magento version for the Issue report. label Oct 10, 2024
@devchris79
Copy link

It sounds like the Nginx configuration isn't right or is being ignored.

Have you tried the wide open configuration to test?

@lcw-media
Copy link

lcw-media commented Oct 15, 2024

Same for me, seems no config error. I use apache.

Adding this into apache vhost config fixed it:
Header set Access-Control-Allow-Origin "*"

But as it worked fine before this is not a good solution

The reason for this behavior can be found in this file:

vendor/magento/module-csp/Plugin/AddDefaultPropertiesToGroupPlugin.php

        if ($integrity && $integrity->getHash()) {
            $properties['attributes']['integrity'] = $integrity->getHash();
            $properties['attributes']['crossorigin'] = 'anonymous';
        }

After setting the integrity, CORS will block the requested file.

So when integrity with crossorigin is set, the Access-Control-Allow-Origin header also have to be set.

@engcom-Bravo
Copy link
Contributor

Hi @anasshl,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

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.
Screenshot 2024-10-29 at 11 12 23 Screenshot 2024-10-29 at 10 03 45

The Page Builder changes fail to save.

Hence Confirming the isuue.

Thanks.

@engcom-Bravo engcom-Bravo added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Component: PageBuilder Area: Content labels Oct 29, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-13294 is successfully created for this GitHub issue.

Copy link

m2-assistant bot commented Oct 29, 2024

✅ Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@JonSau
Copy link

JonSau commented Oct 29, 2024

Facing the same issue. Only solution is to add the Access-Control-Allow-Origin "*" header to NGINX which I'd rather not

@hostep
Copy link
Contributor

hostep commented Oct 30, 2024

You can also circumvent the problem by running bin/magento cache:flush at some point after bin/magento setup:static-content:deploy ... was executed.

The issue seems to be caused by the SRI feature of Magento's CSP module which adds an integrity and crossorigin attribute on each <script> tag in your html (code over here), like @lcw-media mentioned before and that causes issues with page builder somehow.

However, due to the way SRI hashes are stored in cache when running the SCD command (which is considered a bug), the issue can - at the moment - be very easily circumvented by flushing the cache, this also means you loose the SRI protection on scripts though, so you'll have to decide which one you like better.

@smartexcan
Copy link

I commented on the issue linked by hostep not long ago, but might as well here too.

I created a small module to fix the issue only on the pagebuilder_stage_render page.
https://github.com/smartexcan/magento2-page-builder-require-js-fix

Tested with open source 2.4.6-p6

@rutvik-dolphin
Copy link

rutvik-dolphin commented Nov 6, 2024

The same issue occurs on product save from admin in Magento version 2.4.7-p3

@github-jira-sync-bot github-jira-sync-bot added the Progress: PR Created Indicates that Pull Request has been created to fix issue label Dec 20, 2024
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.4-p12]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) [2.4.8-beta2]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) Dec 20, 2024
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.8-beta2]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) [2.4.7-p4]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) Dec 20, 2024
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.7-p4]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) [2.4.4-p12]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) Dec 20, 2024
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.4-p12]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) [2.4.6-p9]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) Dec 20, 2024
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.6-p9]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) [2.4.5-p11]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) Dec 20, 2024
@m2-community-project m2-community-project bot removed the Progress: PR Created Indicates that Pull Request has been created to fix issue label Dec 20, 2024
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: dev in progress labels Dec 20, 2024
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.5-p11]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) [2.4.6-p9]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) Jan 6, 2025
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.6-p9]CORS Errors Prevent Page Builder Content Updates in Magento 2.4.6-p7 (Production Mode) CORS Errors Prevent Page Builder Content Updates (Production Mode) Feb 6, 2025
@github-jira-sync-bot github-jira-sync-bot changed the title CORS Errors Prevent Page Builder Content Updates (Production Mode) [2.4.7-p5] CORS Errors Prevent Page Builder Content Updates (Production Mode) Feb 6, 2025
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.7-p5] CORS Errors Prevent Page Builder Content Updates (Production Mode) [2.4.4-p13] CORS Errors Prevent Page Builder Content Updates (Production Mode) Feb 6, 2025
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.4-p13] CORS Errors Prevent Page Builder Content Updates (Production Mode) [2.4.6-p10] CORS Errors Prevent Page Builder Content Updates (Production Mode) Feb 6, 2025
@github-jira-sync-bot github-jira-sync-bot changed the title [2.4.6-p10] CORS Errors Prevent Page Builder Content Updates (Production Mode) [2.4.5-p12] CORS Errors Prevent Page Builder Content Updates (Production Mode) Feb 6, 2025
@Morgy93
Copy link
Member

Morgy93 commented Mar 19, 2025

@engcom-Bravo What's the current status?
The "Progress: done" label was added two weeks ago, but there has been virtually no real communication since December 2024.

@engcom-Bravo
Copy link
Contributor

Hello,

As I can see this issue got fixed in the scope of the internal Jira ticket AC-13547 by the internal team
Related commits:https://github.com/search?q=repo%3Amagento%2Fmagento2+AC-13547&type=commits

Based on the Jira ticket, the target version is 2.4.8.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Content Component: PageBuilder Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Progress: PR Created Indicates that Pull Request has been created to fix issue Reported on 2.4.6-p7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
Development

No branches or pull requests