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

Support proxies and improve proxy performance #1469

jennifer-shehane opened this issue Mar 16, 2018 · 22 comments

Support proxies and improve proxy performance #1469

jennifer-shehane opened this issue Mar 16, 2018 · 22 comments


Copy link

@jennifer-shehane jennifer-shehane commented Mar 16, 2018


There are several users with corporate proxy issues that are faced at several layers of interacting with Cypress including during:

(a checkmark indicates that a fix is in #3531)

  • cy.visit()
    • #1459
    • #1608
    • #1312 - described behavior is correct
    • #1039 - this timeout will be fixed once we respect proxies, but the error should still be passed through - #1013
    • #939
    • #672
  • npm install
  • cypress verify (maybe?)
    • #787 - not a proxy issue, but the issues described in comments are, and will be fixed
  • accessing the 'Runs' tab within the Test Runner
  • verifying that the server set at baseUrl is running

Things that won't be fixed as part of this issue

Current workarounds:

Setting environment variables

Note: these are NOT cypress environment variables, but system/shell environment variables

  • If using Linux, you can read about setting and reading env variables here
  • If using Windows, you can read about setting and reading env variables here

Set HTTP_PROXY and/or HTTPS_PROXY to your corporate proxy

HTTP_PROXY=http://my-proxy-address cypress run

Set NO_PROXY for localhost to prevent it from hitting corporate proxy

NO_PROXY=localhost cypress run

Other workarounds

For cy.visit()

For Download

For accessing 'Runs' tab in Test Runner

  • If you need to set up a project, you have to do it in this tab. Fortunately, you should only need to do this once. Try to do this once outside of the corporate proxy then you should be good to go.
Copy link

@furnace915 furnace915 commented May 11, 2018

setting the environment variables was very helpful for the npm install on Mac. thx for workaround

Copy link

@murugaratham murugaratham commented Jul 5, 2018

Tried setting env using cross-env HTTPS_PROXY=<my corp proxy> as well as HTTP_PROXY, but request to external resource gets http 407. I am using cntlm and set proxy to go through cntlm, but still unable to get CDN resources, e.g. google fonts

Copy link

@Rende11 Rende11 commented Jul 18, 2018

Tried do this:

PROXY_HTTP="http://proxy.adress" PROXY_HTTPS="https://proxy.adress" npx cypress run --spec cypress/integration/ah-ui.js -b chrome

With electron too, added rules in extension, add extension with VPN, added proxy settings in chrome...
but it doesn't work for me - best result - I can open url in new tab.
In Cypress test I receive -

CypressError: cy.visit() failed trying to load:


The content-type of the response we received from your web server was:

  > null

This was considered a failure because responses must have content-type: 'text/html'
Copy link

@tommorganshaw tommorganshaw commented Aug 15, 2018

I've read everything I can find on this issue and tried every suggested workaround but Cypress still cannot connect to websites through our corporate proxy.

When will this feature be implemented? It is a massive blocker for any possibility of adoption within our team.

Copy link
Member Author

@jennifer-shehane jennifer-shehane commented Aug 15, 2018

@Rende11 See this comment regarding null content-type responses #1727 (comment)

Copy link

@alvarofernandoms alvarofernandoms commented Oct 1, 2018

Did you try to set the corporate proxy into npm config? Like so:

Copy link

@cypress-bot cypress-bot bot commented Apr 1, 2019

The code for this is done in cypress-io/cypress#3531, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@brian-mann brian-mann changed the title Fix corporate proxy issues Support proxies and improve proxy performance Apr 1, 2019
Copy link

@rjd40 rjd40 commented Apr 16, 2019

Great to hear this is now pending release! I've recently started piloting Cypress at work with the goal of wider adoption and the speed issues we've been facing as a result of corporate proxy issues are the only thing currently holding us back.

Any idea when this might be released?

Copy link
Member Author

@jennifer-shehane jennifer-shehane commented Apr 16, 2019

@rjd40 Soon. We have been working on the release - had to pause to fix some potential regressions in the pre-release. 🤞

Copy link

@RicardoVaranda RicardoVaranda commented May 8, 2019

@jennifer-shehane Thanks for all the hard work on this, I have a quick question will this proxy improvement also include authentication for proxy? We have that use case since our corporate proxies require authentication with username and password.

Copy link

@flotwig flotwig commented May 8, 2019

@RicardoVaranda Yes, basic proxy authentication will be supported, just pass the proxy like so:

Copy link

@cypress-bot cypress-bot bot commented May 17, 2019

Released in 3.3.0.

Copy link

@sriram04144 sriram04144 commented Aug 20, 2019

Cannot believe that setting a proxy can be this difficult :( - I have a corporate PAC file for a proxy and I tried setting the HTTP and HTTPS proxies through command prompt, nothing seems to work.

Agreed, I am not a developer, but the complexity might turn away many testers from setting up Cypress.

Copy link

@flotwig flotwig commented Aug 20, 2019

@sriram04144 Have you checked the proxy configuration docs? It explains how to work if all you have is a PAC file. You just need to set HTTP_PROXY to the proxy you need for outbound Internet access.

Copy link
Member Author

@jennifer-shehane jennifer-shehane commented Jan 6, 2020

This issue will be closed to further comment as the exact issue here was resolved and tested.

If you're experiencing a bug similar to this in Cypress or want enhanced functionality for Proxy support, please open a new issue with a fully reproducible example that we can run or explaining the feature you would like.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Jan 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.