How to include Gzip compression to Solid Start project?
Hi, I was using google lighthouse to check the page performance and it suggests to me that I should use gzip compression for json api response.
Is there any easy way to include it to my app?
14 Replies
i think you can include it as some sort of middleware :Worry_Think:
Ok but how
:jeremy:
It suggest me that cuz of response size
:Worry_Think:
how about step by step? I'm not a solidstart expert tho, but imo it basically
1. create a middleware: https://docs.solidjs.com/solid-start/advanced/middleware
2. check some conditions and gzip the content before sending back to the client
there are libs that handle gzip for you
for static assets, nitro already handles it for you
:Worry_WOW:
right, it should be
ah, JSON API response, yeah, then
:Worry_Think:
Depending on where you deploy the app, the server might handle compression as well.
E.g. I have a solid-start-app running on a vps with an nginx server which compresses all responses automatically:
Yeah but i use node-server preset
Yeah me too. Where do you deploy your app?
i get this message on google lighthouse
If you host on a service like Netlify the infrastructure will do compression for you. On a VPS node servers are typically behind a reverse proxy which is then configured to do the compression (usually a lot more efficiently).
Netlify Support Forums
Gzip file serving
In my quest for a faster site I´m looking to serve gzipped files. So I guess I have two options. 1 gzip my files in the build process 2 have the server do the gzipping for me if I were to go for number 2 I{m I correct in thinking that I would have to add this to my headers configuration in the netlify.toml file? Does any one have any tips o...
Linode Guides & Tutorials
Use NGINX as a Reverse Proxy
Learn how to use NGINX as a reverse proxy. Understand how headers and buffers can help optimize your application’s performance.
Problem solved. I just turned gzip compression on admin page of my website
It was just turned off, idk why