cypress removes origin on fetch post requests

Created on 13 Aug 2019  路  5Comments  路  Source: cypress-io/cypress

Currently cypress seems to remove the origin from fetch post requests, this does not happen in firefox, default chrome or safari, in normal mode or incognito mode

Current behavior:

strips the origin from fetch post requests

code example to illustrate behaviour
https://github.com/mcgoooo/cypress-fetch-origin-example

the results are shown in these screenshots

Screenshot 2019-08-13 at 15 58 26

this is different than chrome, sfari and firefox which returns

Screenshot 2019-08-13 at 15 42 50

Desired behavior:

dont strip origin on fetch post requests

Steps to reproduce: (app code and test code)

can be seen by opening a tab in cypress and hitting the following url
https://murmuring-sands-77169.herokuapp.com/

https://github.com/mcgoooo/cypress-fetch-origin-example

Versions

CYPRESS 3.4.1

Most helpful comment

I'm pretty sure I'm running into this.

One of our tests that adds a payment method using Zuora started failing. When we run the test, an authentication alert pops up. This was not the case the last time we ran it manually, where it would normally just 200. In CI it still passes, which led me to believe it had something to do with the chrome version, since the image we're using in CI is not updated to the latest version of Chrome. Using https://chromium.cypress.io, I was able to confirm that the test passes as it did before in versions before 76 but fail in the 76 range. Also confirmed it fails on the latest canary.

Electron 61 - passes
74.0.3729.169 - passes
75.0.3770.100 - passes
75.0.3770.142 - passes
76.0.3809.87 - fail
76.0.3809.100 - fail
78.0.3889.0 - fail

The failing call:
Screen Shot 2019-08-21 at 8 53 13 PM

Zuora's API is pretty finicky, so I think the origin header being stripped off would probably do it.

All 5 comments

  • Origin removed with Chromium and Chrome 76
  • Origin present with Electron 61

I'm pretty sure I'm running into this.

One of our tests that adds a payment method using Zuora started failing. When we run the test, an authentication alert pops up. This was not the case the last time we ran it manually, where it would normally just 200. In CI it still passes, which led me to believe it had something to do with the chrome version, since the image we're using in CI is not updated to the latest version of Chrome. Using https://chromium.cypress.io, I was able to confirm that the test passes as it did before in versions before 76 but fail in the 76 range. Also confirmed it fails on the latest canary.

Electron 61 - passes
74.0.3729.169 - passes
75.0.3770.100 - passes
75.0.3770.142 - passes
76.0.3809.87 - fail
76.0.3809.100 - fail
78.0.3889.0 - fail

The failing call:
Screen Shot 2019-08-21 at 8 53 13 PM

Zuora's API is pretty finicky, so I think the origin header being stripped off would probably do it.

This is related to #2568 but the weird thing is that the issue happens when using cypress run but not cypress open. Someone knows the Chrome-related differences between these two modes?

I have the same issue. It was present in 3.2.0, fixed it by upgrading to 3.4.1. Then decided to go up to 4.1.0... and, "Hi, missing origin, there you are". Only reproducible in Chrome, Electron always works fine

I'm not able to reproduce this in Cypress 4.10.0, so believe this has been fixed since this was opened.

Outside Cypress

Screen Shot 2020-07-14 at 4 07 47 PM

Within Cypress

Screen Shot 2020-07-14 at 4 08 28 PM

Closing as resolved.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

Was this page helpful?
0 / 5 - 0 ratings