feat: use encode gzip for caddy

Compressing assests would lead to readuce transfer size.
  As testing with frontend-app-learning/Olive, the network traffic
  before was about ~4MB, after this it became ~1MB.

  This change was suggested by Google Lighthouse[1], there are of
  course more suggestion but this was one the easiest and one of most
  impactful.

  Also check orignal PR overhangio/tutor-mfe/pull/64 for more
  info.
  [1]: https://web.dev/uses-text-compression
This commit is contained in:
Ghassan Maslamani 2022-10-18 15:10:59 +03:00 committed by Régis Behmo
parent 7453e70fa0
commit 7d32179038
2 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,8 @@ Every user-facing change should have an entry in this changelog. Please respect
## Unreleased
- [Improvement] use caddy `encode gzip` directive to optimize transfer size (by @ghassanmas)
## v14.1.0 (2022-10-10)
- [Improvement] Upgrade Scorm XBlock to v14.0.0. (by @regisb)

View File

@ -20,6 +20,11 @@
}
}
# This will compress requests that matches the default criteria set by Caddy.
# see https://caddyserver.com/docs/caddyfile/directives/encode
# for information about the defaults; i.e. how/when this will be applied.
encode gzip
reverse_proxy {args.0} {
header_up X-Forwarded-Port {{ 443 if ENABLE_HTTPS else 80 }}
}