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

Improved CORSHandler #13677

Merged
merged 1 commit into from Nov 27, 2018
Merged

Conversation

MichaelRoosz
Copy link
Contributor

@MichaelRoosz MichaelRoosz commented Nov 7, 2018

When using the 3rd party cookie, and tracking to piwik with AJAX, the request will (must) include the 3rd party cookie (see #13159 ).

It is already possible to set "cors_domains[] = *" in config.ini.php to allow this.
However "The value of * is special in that it does not allow requests to supply credentials, meaning it does not allow HTTP authentication, client-side SSL certificates, or cookies to be sent in the cross-domain request." (see https://en.wikipedia.org/wiki/Cross-origin_resource_sharing ).

Thus this change avoids the "*" value and also adds the 'Vary: Origin' header.

@tsteur tsteur added this to the 3.8.0 milestone Nov 12, 2018
return;
}

Common::sendHeader('Vary: Origin');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this new header? From what I understand about the header, it exists to tell http caches how to identify a resource when deciding which cached object to use. It doesn't seem related to CORS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6.4 Implementation Considerations
This section is non-normative.

Resources that wish to enable themselves to be shared with multiple Origins but do not respond uniformly with "*" must in practice generate the Access-Control-Allow-Origin header dynamically in response to every request they wish to allow. As a consequence, authors of such resources should send a Vary: Origin HTTP header or provide other appropriate control directives to prevent caching of such responses, which may be inaccurate if re-used across-origins.

https://www.w3.org/TR/cors/#resource-implementation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, 👍

@diosmosis diosmosis merged commit 0cbf386 into matomo-org:3.x-dev Nov 27, 2018
@MichaelRoosz MichaelRoosz deleted the improve_corshandler branch October 29, 2023 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants