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
Why is .js.gz file not being served? #300
Comments
Update: If I change my index.html to request app.js.gz directly it all works. But I thought the whole point of gzipping is that it's done invisibly - your browser can request a normal .js file and secretly receive the .gz one |
In chrome dev tools, check the "Transferred" column or the Only because you see |
If I delete the .js file, so http-server is forced to server the .js.gz file, I get a browser error. So it's definitely not working. |
That's also not how transparent gzipping works. Usually, the server gzips on-the-fly, so the url points to the ungzipped file. I will have a look in a minute. |
To test it, put an ungzipped file in the directory and check the |
I don't know what you mean by |
I agree that it should gzip on Regarding your screenshot: It's not about I will check on my computer in a few minutes. |
The You will have to wait until this is published or use |
damnit, was also wondering why my gzip wasn't working after looking at the code :( |
Sadly, this is not in the 0.9.0 release. |
I'm running After reading through The confusion seems to come from the fact that most servers that have a "simple setup" (and gzip is one of the available options), the server will do the work of gzipping for you (which is what I expected). This should really be called out in the docs to lessen confusion. Possible solutions to anyone that come across this issue:
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/
}) |
@the0neWhoKnocks I definitely agree we need to make this clearer in the docs. I'm not sure, though, that we should add any compression magic to the code--as it goes a bit against the whole static server thing. It would be good to have more docs and tests around this bit, so it's more obvious how it works and what steps one needs to take to use it. |
@BigBlueHat Agreed. Calling out that this module is a |
Running Thanks for all the good work! ✌️ |
Great to hear @thescientist13! I'd love some tests for this added, so we can be sure to avoid regressions. I'll leave this open for anyone interested in sending a PR to improve the tests and/or README. |
@thescientist13 as I stated above, it worked if you generated your own |
The gzip option in the README now specifies that it looks for an existing file. Since there are plenty of tests in ecstatic around gzip (and brotli), I'm going to consider this done. |
This does not work at all. .gz file created, -g and --gizp flag usdD. Only the .js loads. This thread needs reopening |
This comment has been minimized.
This comment has been minimized.
@Nashorn What is the |
were you able to fix providing gzip content to <script> tag? |
I gzipped my
app.js
toapp.js.gz
and then ranhttp-server -g
, as specified in the readme of this website.But my browser still receives the .js file, not the .js.gz file, as you can see in the screenshot. Is this is a bug?
The text was updated successfully, but these errors were encountered: