I'm running Cypress tests on https://localhost:3000
, which is my CYPRESS_BASE_URL
also. Navigating to /
redirects to /en
internally, which works fine. But the test that I'm writing is about a form which builds a new URL, like https://localhost:3000/foobar?param=value
. This works finde, I can even see the page that I'm redirecting to. But Cypress complains about this:
Cypress detected a cross origin error happened on page load:
> Blocked a frame with origin "https://localhost:3000" from accessing a cross-origin frame.
Before the page load, you were bound to the origin policy:
> https://localhost:3000
A cross origin error happens when your application navigates to a new URL which does not match the origin policy above.
A new URL does not match the origin policy if the 'protocol', 'port' (if specified), and/or 'host' (unless of the same superdomain) are different.
Cypress does not allow you to navigate to a different origin URL within a single test.
You may need to restructure some of your test code to avoid this problem.
Alternatively you can also disable Chrome Web Security in Chromium-based browsers which will turn off this restriction by setting { chromeWebSecurity: false } in cypress.json.
I do not want to disable chromeWebSecurity
(which works), since I'm running this test on Firefox also. The only thing I can imagine is the way I do the redirect: window.location.href = "/foobar?param=value"
.
The error message is about changing protocol
, port
or host
, but I'm doing none of them, and my SSL certificate is a valid one.
Could this be a bug or did I overlooked something?