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

Safari blocks cookies for iFrame domain when domain doesn't match source website #18530

Closed
Starker3 opened this issue Dec 22, 2021 · 9 comments
Closed
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@Starker3
Copy link
Contributor

It seems that the recent updates to the Safari browser (Prevent cross-site tracking) blocks any cookies from being generated when the Matomo domain doesn't match the website it's being loaded from.

This breaks the use of iFrames for Matomo that require cookies to be set (For example the logme feature)

There doesn't seem to be any way to fix this with headers (Eg using CSP or CORS configurations).

2 current workarounds exist that I've found:

  1. Disable the "Prevent cross-site tracking" setting in the Privacy settings
  2. Redirect the visitor to the page outside of an iFrame to set the cookie - after this the iFrame can load as long as the CORS configuration is correct and the browser isn't completely blocking the iFrame from loading.

I'm not sure how many users are using iFrames that would require cookies to be set, but they would be impacted if any of their users use Safari.

@Starker3 Starker3 added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Dec 22, 2021
@bastos71
Copy link

bastos71 commented Jan 24, 2022

We encountered the bug on our side as well.
We're planing to customize the index.php (target of the iframe) to add a link / button to open the link in a new tab/window to prevent this error for Safari users

@tsteur
Copy link
Member

tsteur commented Jan 25, 2022

FYI in #17452 we will be working on an Opt Out solution that works without iframes meaning this should then no longer be a problem once this new opt out is used

@Findus23
Copy link
Member

Findus23 commented Mar 6, 2022

This also affects the opt-out feature on the personal settings page inside of Matomo:
grafik

And as there is no direct way to set cookies on another domain there, we might need to remove that feature (or replace it with an explaination)

@heurteph-ei
Copy link

@Findus23 if I am not wrong, the link « Click here to set a kokie that will exclude your visits on websites tracked by Matomo... » opens a new window/tab. Then the cookie can be generated without any problem if I read Starker3's 2nd workaround...

@Findus23
Copy link
Member

@heurteph-ei But wouldn't the link then not need to open the domain of the website that is tracked as the cookie needs to be stored there (or at least stored while on that site)?

@heurteph-ei
Copy link

As I understand (I may be wrong), the opt-out feature uses a 3rd party cookie, as it is explained by «... your visits on websites tracked by Matomo on dev.matomo ».
The thing pointed out by Starker id that on Safari, you can create the cookie only if you are in the website itself. As the link opens a new window/tab, it should work...

@TechDad3949
Copy link

Anyone find a way to allow this in Safari (I am looking for options I can set on the web server)?

@sandeepks230
Copy link

We have a django app that is embedded in shopify. This works fine in Chrome and Mozilla but it is not working in Safari Browser as an iframe as it is blocking all the cookies. So all the POST requests are getting rejected because of forbidden csrf. Is there any solution for this. After disabling Prevent Cross Site Checking in Safari Browser it is working fine and storing CSRF cookies and all. Is there any other solution to this?

@justinvelluppillai justinvelluppillai added answered For when a question was asked and we referred to forum or answered it. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Nov 4, 2022
@justinvelluppillai
Copy link
Contributor

This was fixed in #19528

Please see the announcement also - https://matomo.org/blog/2022/09/improvements-to-matomo-opt-out-form-feature/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

8 participants