I'm zipping the front-end files in react and setting up a server in nginx to serve them.
Using gzip compression, I managed to get the server to return the front-end files normally, everything working correctly.
I find it difficult to do the same with brotli compression, I tried it in two ways.
- Serving nginx the files without compression and setting it to compress (brotli) before sending to the client.
- Compressing the front-end files with brotli via webpack and setting brotli_static in nginx. I have to solve the problem in this way i.e. the front end compresses the files
But none of the above ways work, below some relevant information.
Other points:
Some other simple way to serve brotli files so I can validate if the error is in nginx or webpack compression ?
I followed this link to install nginx and brotli modules
Front-end compression with gzip and nginx gzip_static on I just needed to enable gzip_static on;
brotli compression by nginx - brolti on; the "content-encoding" remained the same, it should change
Compressing files in brotli by webpack and setting brotli_static on in nginx