How to make Google Cloud CDN serve gzip compressed content.
Google Cloud CDN is not like Cloudflare, which can make you serve gzip compressed content on the proxy servers with just one click.
Add these two lines below into
gzip_proxied any; gzip_vary on;
And restart the Nginx server.
According to Google Cloud CDN troubleshooting:
The first line enables compression even for requests forwarded by a proxy like HTTP(S) load balancing.
The second line adds a
Vary: Accept-Encodingheader to responses.
Vary: Accept-Encodingnotifies caching proxies such as Cloud CDN that they should maintain separate cache entries for compressed and non-compressed variants of compressible resources.
如果覺得這篇文章對你有幫助， 除了留言讓我知道外， 或許也可以考慮請我喝杯咖啡， 不論金額多寡我都會非常感激且能鼓勵我繼續寫出對你有幫助的文章。
If this blog post happens to be helpful to you, besides of leaving a reply, you may consider buy me a cup of coffee to support me. It would help me write more articles helpful to you in the future and I would really appreciate it.