How do I allow secure http(not s) cookies with Cypress and Firefox?

Viewed 642

I have a simple Cypress test that tests login. The page it is logging into is running on port 80 as http for testing. Because of this the cookies are not set to secure. When I try running the test I get....

Cookie “token” has been rejected because a non-HTTPS cookie can’t be set as “secure”.

If I run in a regular private Firefox window this does not happen. Is there a Cypress config setting I need or something?

If I convert to secure = false cookie it works. However, the secure cookie via http doesn't block it on a regular private FF browser.

1 Answers

Cypress has an open issue for Firefox not recognizing localhost as a secure context.

For the time being, I recommend testing in another browser. Alternatively, you could not set the secure flag on the cookie when working locally, but a number of recent web technologies depend on secure contexts (e.g., service workers), so you could encounter the same underlying issue while testing other parts of your site.

Related