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

Closed
10 tasks done
jennifer-shehane opened this issue Mar 16, 2018 · 22 comments · Fixed by #3531
Closed
10 tasks done

Support proxies and improve proxy performance #1469

jennifer-shehane opened this issue Mar 16, 2018 · 22 comments · Fixed by #3531
Assignees
Labels
Epic Requires breaking up into smaller issues type: bug

Comments

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 16, 2018

Problem

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)

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.
@furnace915
Copy link

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

@murugaratham
Copy link

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

@Rende11
Copy link

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:

https://mytestsite

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'

@tommorganshaw
Copy link

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.

@jennifer-shehane
Copy link
Member Author

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

@alvarofernandoms
Copy link

Did you try to set the corporate proxy into npm config? Like so: https://stackoverflow.com/a/33892578

@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs review The PR code is done & tested, needs review labels Mar 1, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Mar 13, 2019
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs review The PR code is done & tested, needs review labels Mar 27, 2019
@cypress-bot
Copy link
Contributor

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
@rjd40
Copy link

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?

@jennifer-shehane
Copy link
Member Author

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

@RicardoVaranda
Copy link

@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.

@flotwig
Copy link
Contributor

flotwig commented May 8, 2019

@RicardoVaranda Yes, basic proxy authentication will be supported, just pass the proxy like so: http://username:password@your-proxy-server.net

@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 17, 2019

Released in 3.3.0.

@sriram04144
Copy link

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.

@flotwig
Copy link
Contributor

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.

https://docs.cypress.io/guides/references/proxy-configuration.html

@jennifer-shehane
Copy link
Member Author

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.
Labels
Epic Requires breaking up into smaller issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.