CORS is not reflected in Ajax calls (requests are send as anonymous)

Created on 29 May 2024, 28 days ago
Updated 12 June 2024, 13 days ago

Problem/Motivation

We have multilingual sites setup using a different domainname for each language. We also setup the admin ui so that the translate tab on a node opens up in a modal dialog. When you hit the "edit" for one of the translations, the node edit form is opened also in a modal dialog.
CORS is setup to allow all our domains, supportsCredentials is enabled, methods are POST,GET and OPTIONS. exposedHeaders has the 'X-Drupal-Ajax-Token'.
When the Ajax calls are made to open the node edit forms in the second dialog, the calls are made anonymous. The session token is not send.

Steps to reproduce

Setup multilingual site with at least 2 languages.
Use different domain for each language.
Setup CORS as described above.

Proposed resolution

To solve this, ajax.js needs to configure extra options when doing the requests:
- crossDomain: true
- xhrFields: { withCredentials: true }

Remaining tasks

Check if this has any impact on other Ajax related stuff.

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Kinda messed up with the branches in the original ticket 3338518, so started from fresh.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
AjaxΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium kriboogh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024