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

Issue the CORS header (Access-Control-Allow-Origin) also on Tracking API requests #12207

Merged
merged 2 commits into from Nov 19, 2017

Conversation

mattab
Copy link
Member

@mattab mattab commented Oct 18, 2017

Follows up #7626 #5993

@mattab mattab added the Needs Review PRs that need a code review label Oct 18, 2017
@mattab mattab added this to the 3.2.1 milestone Oct 18, 2017
core/Tracker.php Outdated
@@ -94,6 +95,10 @@ public function main(Handler $handler, RequestSet $requestSet)
try {
$this->init();
$handler->init($this, $requestSet);

$corsHandler = new CORSHandler();
Copy link
Member

Choose a reason for hiding this comment

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

maybe we put this into init? Or before init out of the try/catch as it seems to not throw an exception?

Actually... After a while of thinking it should be done right after Tracker::loadTrackerEnvironment(); in piwik.php I reckon. Since main() might be also used when not being in a web context, and piwik.php makes it actually available to the web so it should be there. This keeps the code cleaner and better re-usable etc. The tracker class and main method is built to be used with different request and this keeps the responsibility to tracking and not to output handling (which is mainly done in piwik.php).

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely right 👍 made the change

@mattab mattab merged commit ca0a9aa into 3.x-dev Nov 19, 2017
@mattab mattab deleted the cors_tracking_api branch November 19, 2017 21:19
@matomo-org matomo-org deleted a comment from MatomoForumBot Dec 4, 2017
@mattab mattab added c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. labels Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants