Skip to content

Commit fdd5a72

Browse files
namedgraphclaude
andcommitted
Scope nginx gzip to static locations only
Move gzip config from http block into /static/ and /uploads/ location blocks so dynamic RDF responses are never compressed, preserving strong ETags for If-Match precondition checks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 11f2c33 commit fdd5a72

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

docker-compose.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -193,25 +193,6 @@ configs:
193193
194194
client_max_body_size ${MAX_CONTENT_LENGTH:-2097152};
195195
196-
gzip on;
197-
gzip_proxied any;
198-
gzip_types
199-
application/json
200-
application/ld+json
201-
application/rdf+xml
202-
application/sparql-results+json
203-
application/sparql-results+xml
204-
application/trig
205-
application/n-quads
206-
application/n-triples
207-
application/xml
208-
text/turtle
209-
text/css
210-
text/javascript
211-
application/javascript
212-
image/svg+xml;
213-
gzip_min_length 1024;
214-
215196
# server with optional client cert authentication
216197
server {
217198
listen 8443 ssl;
@@ -223,8 +204,6 @@ configs:
223204
ssl_verify_client ${NGINX_SSL_VERIFY_CLIENT:-optional_no_ca};
224205
225206
location / {
226-
gzip off; # disable gzip for dynamic content to preserve strong ETags for If-Match
227-
228207
add_header Access-Control-Allow-Origin "*" always;
229208
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS" always;
230209
add_header Access-Control-Allow-Headers "Accept, Content-Type, Authorization" always;
@@ -253,6 +232,11 @@ configs:
253232
}
254233
255234
location ^~ /uploads/ {
235+
gzip on;
236+
gzip_proxied any;
237+
gzip_types *;
238+
gzip_min_length 1024;
239+
256240
proxy_pass http://linkeddatahub;
257241
limit_req zone=static_files burst=20 nodelay;
258242
@@ -268,6 +252,11 @@ configs:
268252
}
269253
270254
location ^~ /static/ {
255+
gzip on;
256+
gzip_proxied any;
257+
gzip_types *;
258+
gzip_min_length 1024;
259+
271260
proxy_pass http://linkeddatahub;
272261
limit_req zone=static_files burst=50 nodelay;
273262
@@ -287,8 +276,6 @@ configs:
287276
ssl_verify_client optional_no_ca;
288277
289278
location / {
290-
gzip off; # disable gzip for dynamic content to preserve strong ETags for If-Match
291-
292279
add_header Access-Control-Allow-Origin "*" always;
293280
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS" always;
294281
add_header Access-Control-Allow-Headers "Accept, Content-Type, Authorization" always;
@@ -317,6 +304,11 @@ configs:
317304
}
318305
319306
location ^~ /static/ {
307+
gzip on;
308+
gzip_proxied any;
309+
gzip_types *;
310+
gzip_min_length 1024;
311+
320312
proxy_pass http://linkeddatahub;
321313
limit_req zone=static_files burst=50 nodelay;
322314

0 commit comments

Comments
 (0)