w3champions / website

The webpage for the www.w3champions.com community project.
47 stars 54 forks source link

Enable transport compression for backend API #667

Open Rotzbua opened 1 year ago

Rotzbua commented 1 year ago

Problem

The API does not compress the (json) response. This leads to high traffic and increased loading times.

Example

Statistics URL: https://w3champions.com/OverallStatistics/

API Requests:

Source test result: https://pagespeed.web.dev/analysis/https-w3champions-com-OverallStatistics/7jpdz9z2je?form_factor=mobile

Possible solution

A) Enable compression at the proxy

https://github.com/w3champions/website/blob/76c877ee9247bb39a20882469c8db470f2331714/docker-compose.token.yml#L23-L26

Remove compression by frontend container: https://github.com/w3champions/website/blob/master/gzip.conf

B) Use Cloudflare (uses compression by default)

Reference

https://developer.chrome.com/docs/lighthouse/performance/uses-text-compression/