8000 Use Surrogate-Key headers for docs.python.org (#510) · python/psf-salt@3152de3 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 3152de3

Browse files
authored
Use Surrogate-Key headers for docs.python.org (#510)
* Use Surrogate-Key headers for docs.python.org * Add header only if content-negotiation emulation fails
1 parent a45ca9a commit 3152de3

File tree

2 files changed

+666
-0
lines changed

2 files changed

+666
-0
lines changed

salt/docs/config/nginx.docs-redirects.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ location ~ ^/((2|3)(\.[0-9]+)?|dev)/\w+/[\d\w\.]+(?!\.html)$ {
185185
if (-f "${request_filename}.html") {
186186
return 301 https://$host:$request_uri.html;
187187
}
188+
add_header Surrogate-Key en/$1 always;
189+
}
190+
191+
# Add the Surrogate-Key for bulk CDN purging
192+
# xref https://docs.fastly.com/en/guides/working-with-surrogate-keys
193+
location ~ ^/((2|3)(\.[0-9]+)?|dev)/ {
194+
add_header Surrogate-Key en/$1 always;
195+
}
196+
location ~ ^/(es|fr|id|it|ja|ko|pl|pt-br|tr|uk|zh-cn|zh-tw)/((2|3)(\.[0-9]+)?|dev)/ {
197+
add_header Surrogate-Key $1/$2 always;
188198
}
189199

190200
# Map old, 2.5-and-earlier directory names to 2.6-and-later names.

0 commit comments

Comments
 (0)
0