-
Notifications
You must be signed in to change notification settings - Fork 33
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
ERR_CONTENT_DECODING_FAILED for wasm.wasm when Chrome doesn't accept 'br' compression #28
Comments
Here's a picture of the Network traffic tab in Chrome for reference: The Status was Here are the lines around wasm.js with the failure: async function init(input) {
const imports = getImports();
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
input = fetch(input); # <---- failure on this call, line 1997
}
... |
In comparing the headers of a successful request to the failing, I see these difference: Successful request (to 127.0.0.1):
Failed attempt (to 192.168.68.107):
I noticed that with the failed request, the |
And I see that the server is basically only able to serve wasm-server-runner/src/server.rs Line 59 in fc6ff38
So in summary, I think for some reason Chrome is not accepting |
Basically revert #22 or consider adding more compression formats to the WASM file. |
Thanks @daxpedda ! That looks like a fairly straight-forward solution! I'm thinking of a couple possible approaches for the fix then:
With regard to being a Chrome bug, I don't have insight into this, but can speculate that it may have something to do with loading from JavaScript or maybe some heuristic that files on local networks shouldn't be compressed if the transfer rate is high enough (I'm guessing that for localhost, compression is probably just a waste of time, and for a gigabit/s LAN network, maybe only light compression is needed, if any). The compression timing table in #22 (comment) shows that gzip outperforms br compression at the lowest compression levels (e.g., level 1-2), and probably performs better on fast networks, so Chrome might take this into account. I started working on a PR last night, and was attempting to start with testing-first. To avoid needing to test a full-blown server, I did some light refactoring to server::run_server to pull out the logic that creates the Router and then added some testing just for that portion of the server (since that's the logic that is failing). Let me know if such a refactoring and light testing would be accepted in addition to functional changes to support gzip. Thanks! |
See jakobhellermann#28 for context. This new code will serve up br compressed if supported, but will fall back to gzip compression if not.
See jakobhellermann#28 for context. This new code will serve up br compressed if supported, but will fall back to gzip compression if not.
Just ran into this. Thanks @heisencoder for the debugging and the subsequent PR! |
Just hit the same problem and remembered this, did some research on it and found this:
So that's the reason why both Chrome and Firefox don't support Brotli with HTTP except on |
I've switched to just using tower_http compression in 5eeb8d5. This should mean that this error is fixed now, right? |
Unfortunately, I don't have my Rust environment from last year available right now to verify, so am hoping someone else could verify. |
I can confirm this works for me on Firefox and Chromium. Thanks @jakobhellermann, @heisencoder, et al! |
nice. Also sorry again for taking a year to fix this 😅 |
I'm having trouble getting this server to properly run when connecting via a separate computer.
In particular, if I run this command (with my computer's IP address on the local network):
and then try to connect at
http://192.168.68.107:1334/
, thewasm.wasm
file fails to load.In looking at my network traffic (Chrome 107.0.5304.68 running on Ubuntu Linux 22.04), I see that these loads work correctly with status code 200:
However, when loading
http://192.168.68.107:1334/api/wasm.wasm
, I get no response.Note that when I change WASM_SERVER_RUNNER_ADDRESS to something like 0.0.0.0 or 127.0.0.1, then visiting 127.0.0.1 does allow wasm.wasm to correctly load. However, attempting to load via the server's IP address fails.
(This is needed for me to load from a different computer on the LAN, since the other computer can't use 127.0.0.1)
The text was updated successfully, but these errors were encountered: