Skip to content

Commit 1fa8ac7

Browse files
wmuldergovbcgov-brwang
authored andcommitted
DBC22-6080: Add Brotli/zstd compression to backend
1 parent e56d6c6 commit 1fa8ac7

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

compose/frontend/default.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ map $http_accept $client_format {
4848

4949
map $http_accept_encoding $normalized_encoding {
5050
default "";
51+
"~*zstd" "zstd";
5152
"~*br" "br";
5253
"~*gzip" "gzip";
5354
}

src/backend/config/settings/django.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
MIDDLEWARE = [
4545
'django_prometheus.middleware.PrometheusBeforeMiddleware',
46-
"django.middleware.gzip.GZipMiddleware",
46+
"django_http_compression.middleware.HttpCompressionMiddleware",
4747
"django.middleware.http.ConditionalGetMiddleware",
4848
"django.middleware.security.SecurityMiddleware",
4949
"whitenoise.middleware.WhiteNoiseMiddleware",
@@ -87,6 +87,7 @@
8787
'SHOW_TOOLBAR_CALLBACK': lambda request: SHOW_DEBUG_TOOLBAR,
8888
}
8989

90+
9091
# Auth
9192
AUTH_USER_MODEL = "authentication.DriveBCUser"
9293
AUTH_PASSWORD_VALIDATORS = [
@@ -158,6 +159,7 @@
158159
"drf_spectacular",
159160
"drf_spectacular_sidecar",
160161
'django_prometheus',
162+
'django_http_compression'
161163
]
162164

163165
LOCAL_APPS = [

src/backend/requirements/base.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ django-debug-toolbar==6.1.0
3232
django-prometheus==2.4.1
3333
django-redis==6.0.0
3434
PyJWT==2.11.0
35-
cryptography==46.0.5
35+
cryptography==46.0.5
36+
django-http-compression[brotli]==1.4.0

0 commit comments

Comments
 (0)