fix(nginx): return 404 for non-existent articles/ and sections/ paths
Previously nginx try_files fell back to /index.html for any unmatched path, which meant orphaned article variants (old slug directories) returned HTTP 200 with the homepage content. This caused ~1,150 orphaned pages to be crawlable. Add explicit location blocks for /articles/ and /sections/ that use =404 instead of falling back to /index.html.
This commit is contained in:
+7
-1
@@ -32,7 +32,13 @@ RUN echo 'server { \
|
|||||||
location / { \
|
location / { \
|
||||||
try_files $uri $uri/ /index.html; \
|
try_files $uri $uri/ /index.html; \
|
||||||
} \
|
} \
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp|avif)$ { \
|
location /articles/ { \
|
||||||
|
try_files $uri $uri/ =404; \
|
||||||
|
} \
|
||||||
|
location /sections/ { \
|
||||||
|
try_files $uri $uri/ =404; \
|
||||||
|
} \
|
||||||
|
location ~* \\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp|avif)$ { \
|
||||||
expires 1y; \
|
expires 1y; \
|
||||||
add_header Cache-Control "public, immutable"; \
|
add_header Cache-Control "public, immutable"; \
|
||||||
} \
|
} \
|
||||||
|
|||||||
Reference in New Issue
Block a user