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

Header content type always return gzip #30

Closed
saddamhbb opened this issue Jul 28, 2019 · 2 comments
Closed

Header content type always return gzip #30

saddamhbb opened this issue Jul 28, 2019 · 2 comments
Labels

Comments

@saddamhbb
Copy link

saddamhbb commented Jul 28, 2019

Hello,
I create a server side rendered react app, for compression I use webpack plugin to compress js files into gzip and brotli. It compressed successfully. But, I got an issue about response header. It always return content type gzip.

If I only compress the js files into brotli, and run the project. The response header return content of application/javascript;charset=UTF-8.

My project runs locally using nodemon (No SSL), I use Latest Chrome and Latest Express static gzip.

is there any configuration that I need to use to make the header return content type of brotli?

This is my code screenshot and the response header:
https://res.cloudinary.com/spacesam/image/upload/v1564329266/code-gzip.png
https://res.cloudinary.com/spacesam/image/upload/v1564329215/gzip.jpg

@tkoenig89
Copy link
Owner

In general this seems to be correctly configured and the response in gzip seems to be correct as well. I'm nur sure I understand the full issue. Maybe you can describe what you want to achieve, and what content-encoding you might expect.

Just to explain, why I think, your setup seems to work fine (maybe this helps):

  • Your Browser is asking for content with gzip or deflate encoding ("Accept-Encoding"-Header)
  • You set up your server to prefer brotli over gzipover other compressions (orderPreference). This will overwrite the browsers preferences and serve what is supported by the browser, but prefered by the server

So when your browser asks for gzip or deflate, expressStaticGzip will try to serve brotli (as it's highes in your orderPreference), but won't find it supported by the browsers accept-encoding header. Therefore it will serve gzip, as it's next in your orderPreference.

@tkoenig89
Copy link
Owner

Closed due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants