-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add HTTP/2 Support in Proxy Layer #3708
Add HTTP/2 Support in Proxy Layer #3708
Comments
What are the smallest next steps possible to bring this ticket forward? I found there's https://github.com/cypress-io/cypress/tree/develop/packages/https-proxy and in there is also a test suite.
|
@sesam There's two systems at play here, neither of which support HTTP/2 at this time:
I think that, for real performance gains, both (1) and (2) would have to be updated to speak HTTP/2. This could be done in two separate PRs. After that's completed, an HTTP/2 conversation inside of Cypress would look like this (similar to how HTTPS connections are handled in Cypress currently):
I haven't worked directly with HTTP/2 yet, but does this make sense? There are several different places where tests would need to be added, but it sounds like your ideas for test coverage would be a good start. Some quick notes from messing with (1):
|
I would like to mention that this is not only performance issue. All projects that use http2 streams they just can't use Cypress. |
@midan888 nobody from Cypress is currently working on this issue. |
For completeness, this is virtually all servers not running on localhost in development mode, so this feature would help a huge number of usecases. |
I'm trying to test my Sveltekit app which use FaunaDB's document streaming to update the page in real-time. It works when tested manually with the dev server but not when tested in Cypress. |
Are there any updates on this issue at this point?? My team is trying to use Cypress to test our app that is using grpc-web services and we are currently unable to intercept requests or even make successful requests currently from our app in a Cypress test. |
Is there a way to entirely disable proxy? |
This could be solved with #22319 |
As a workaround, I modified resources/app/packages/server/lib/browsers/chrome.js to exclude my http/2 requests since they use a different port in order to not break the streaming support: |
+1 :) |
An update on this would be great to see. :) As it stands, projects using http/2 seem to have to look elsewhere. |
Agreed, it's slow with many chunks, some of the slowness was addressed in this PR #25209 which was released in Cypress 12.3.0, if you can update to 12.3.0, that might help, it helped my app using Vite load much quicker in Cypress. Another user reported the same, see here: #22868 (comment) (this thread has a ton of info about the exact problem you are encountering). That actual HTTP/2 improvements will be the biggest help, this is getting worked on but I am not sure on ETA. |
Perf is definitely better since 12.3.0, thank you to all contributors for that. However, it is still noticeably slower, especially in the vite use case. HTTP2 seems like a win-win direction, but id also note the convo on #25201. |
@lmiller1990 I did update us and saw ~20% test speed increase, however definitely looking forward to http2 |
Actually, I've changed my mind on this. HTTP2 might not be the core issue at hand in many scenarios. See #25201 (comment) |
+1 |
1 similar comment
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Just wondering whats happening regarding support got http2 - my current project has switched to http2, now all tests are broken and getting pressured to use another framework that supports it. |
Hi @markbeaman44 - your app should work fine, even if you are using HTTP/2 - if you've got a minimal reproduction, I'd recommend creating a new issue and we can take a look. This issue in relating to how Cypress internally handles requests - the idea is to use HTTP/2 for performance reasons. Apps using HTTP/2 work fine right now, they might just load bit slower when running in Cypress. If you have an actual issue where an app using HTTP/2 is not working at all in Cypress, please share a minimal reproduction in a new issue and we can take a look. Thanks. |
@lmiller1990 it doesn't work if you use a lot of streaming connections due to the lack of multiplexing with http/1.1. Originally I was able to work around it because our application used a separate port for the streaming connections (grpc). I bypassed the proxy for the streaming connections. But now we consolidated to a single port, so all of my tests are broken also. |
Right, I see, I think this makes sense. If you can post a minimal reproduction, that would be really useful -- ideally in a separate issue. Having more "my app cannot be tested in Cypress" like use cases will greatly help with prioritizing this feature. Right now, the main reason to do this is to make Cypress faster -- performance is always good to have, but a real business use case (eg - "I want to use Cypress, but I can't) certainly helps the product team when they re-evaluate the priority on issues every other month or so. Thank you! |
Hi @lmiller1990 created a bug for it: #27333 let me know if more info is needed. |
If your tests are crashing and you don't have a clue why- it's worth reading it. tl;dr
long story- While I was reaching a dead-end with my investigation, something else caught my attention. I won't go into too much details, trying to make a long story short, but at some point we noticed that Firefox does cache the resources, there were no crashes at all with it and the total runtime was dramatically improved (somewhere between 2 to 3 times faster). Using Firefox is legit in our use-case however I think we can't rely on it for too long as this behavior can change in any future version / security patch of Firefox (I believe Chrome doesn't cache the resources because of some integrity issues with Cypress proxy). Determined to find a solution for the cache and HTTP/2 usage I ended up in this thread. The workaround we currently use is to launch Chrome with a modified value for the {
// ...
e2e: {
setupNodeEvents(on, config) {
on('before:browser:launch', (browser = {} as Browser, launchOptions) => {
if (browser.family === 'chromium' && browser.name !== 'electron') {
const indexOf = launchOptions.args.indexOf('--proxy-bypass-list=<-loopback>');
const proxyByPassList = [
'<-loopback>',
'gstatic.com',
'google.com',
// list of hostnames that should bypass Cypress proxy
];
const proxyByPassListFlag = `--proxy-bypass-list=${proxyByPassList.join(';')}`;
console.log(`replacing ${launchOptions.args[indexOf]} with ${proxyByPassListFlag}`);
launchOptions.args[indexOf] = proxyByPassListFlag;
}
return launchOptions;
});
// ...
},
}
// ...
} Disclaimer and notes for suggested workaround:
[side note] related issues: |
@talsi Thank you for your write-up, though sadly this won't help most Vite users, because there all the module resources come from the same domain and port as the base URL. |
is there anyone working on this yet? i'm willing to give it a try 🕵️ since it's been 5 years from when this issue was created and still no http2. |
On our end, we ended up migrating to Playwright to avoid any issues... |
@andreizet We're not currently prioritizing this work. The last time we looked at this, the thought was to replace our |
+1. Just upgrade to Angular 17 and the new vite-based build system. My cypress tests frequently fail now because they stall out waiting for the 100+ |
Hi, same thing here. We recently updated our angular builder from webpack to esbuild (using angular 17) and as expected the number of chunks generated is very much larger. As Cypress proxy does not support http2, our cypress pipeline is now 10min slower than before which is not acceptable. |
Hello, do you find a way to deal with? |
The proxy layer currently doesn't really support HTTP/2. The only case in which a user can take advantage of HTTP/2 is if they are making a non-intercepted request through the
https-proxy
, and when #687 lands, all requests will be intercepted. When a request is intercepted, it can't be upgraded to HTTP/2.Take this page, which loads 1000 images: https://flotwig.github.io/cypress-fetch-page/index1000.html
Loaded with HTTP/2, 1000 images load in 1362ms on my browser.
With HTTP/1.1, it takes 3896ms - three times as long.
Making our backend requests use HTTP/2 would give us a huge performance boost for making requests against servers that support it.
Obstacles:
request
library doesn't support HTTP/2 - we'd need to fork or figure out a different way to try to upgrade tohttp2
The text was updated successfully, but these errors were encountered: