-
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
Brotli encoding request fails (ERR_CONTENT_DECODING_FAILED) #6197
Comments
@backfromreality Can you provide a repo with Brotli encoded files used in a request through Cypress tests? Providing a way for us to get this running quickly will be the fastest way to get your issue addressed. |
@jennifer-shehane I tried to start own app on localhost with brotli encoded files and visit localhost by cypress but got an error like this #5446 also found one more unclear thing for me repo with google.co.in visiting ---> repo |
@backfromreality Cypress only currently supports injecting into non-compressed or gzip-compressed content. But Brotli could probably be added easily too since IIRC it's part of Node's standard lib. |
UPD: You can close this issue, or rename and bind it to this comment #6197 (comment) |
Same issue for me. It passes accept-encoding brotle but can't really decode it. |
@backfromreality could u tell me why exactly server config was incorrect? I can't really find smth wrong, I think maybe google just knows that cypress doesn't work with brotli and ignore fact that it sends accept brotli header? |
https://docs.cypress.io/api/commands/visit.html#Arguments |
I'm facing the similar issue. My server is compressed file to .brr. However, whenever my frontend request the compressed file, server can only return the gzip file. It's similar to the case of |
@egemon Hi! Could you please specify which arguments did you add to |
@jennifer-shehane I have this issue reproduced while trying to visit public site
|
Following-up on this since we're bumping into the same issue. @egemon How did you work around it? |
Cypress strips any non- cypress/packages/proxy/lib/http/request-middleware.ts Lines 69 to 82 in 64a60f4
So unless there's some bug with this, it is a problem with your upstream server for continuing to serve |
I'm looking at the headers of the cy.visit() request and it contains: |
Yes, i'm seeing the same thing. |
any updates on this??? I have a more specific scenario. |
Hello, can you tell me which settings was wrong ? i have the same issue and it seems related to server conf also |
@flotwig are there any current plans to add brotli support? I found this to actually cause problems when running against apps served via CloudFront - https://stackoverflow.com/questions/68054148/why-does-cloudfront-sometimes-serve-gzip-instead-of-br-when-both-are-enabled In short, if Cypress is the first to access a resource via CloudFront, it causes the asset to permanently be cached as gzip in cloudfront since the Apart from that, brotli support would probably improve Cypress performance overall due to less bytes on the wire, so would be a great thing to have. As you correctly assume, Node has native support for Brotli - https://nodejs.org/api/zlib.html#zlib_class_brotlioptions |
I tested those behaviors inspecting my own server. Some notes:
Side note: although I highly hope that cypress will introduce brotli support (we are in 2022… and today is the second birthday of this issue 🥳 🥳 🥳 🥳 ) if this behavior is leading any issue to your tests, you have (probably) a proxy cache issue: you should provide both brotli and gzip content. |
We'll be opened a PR to address some of the situations in this thread, but not all. This issue should address when:
|
Requests with encoding content by Brotli compression algorithm always fails.
Current behavior:
Request header:
Response header:
Result:
Request has status 200 OK, but failed with an error
ERR_CONTENT_DECODING_FAILED
.Desired behavior:
Request header:
Response header:
Result:
Request 200 OK. Files successfully decoded.
Test code to reproduce
Start any tests on project, where files are encoded with Brotli algorithm.
Use any browser and method to run the tests.
Versions
Requests began to fail, when the encoding of our files was changed (2 month ago)
In the last version of Cypress (3.8.2) bug also exists and could be reproduced in any browser.
The text was updated successfully, but these errors were encountered: