Repository navigation
Expand file tree
/
Copy pathmain.tf
More file actions
84 lines (77 loc) · 1.95 KB
/
Copy pathmain.tf
File metadata and controls
84 lines (77 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
resource "fastly_service_vcl" "peps" {
name = "peps.python.org"
activate = true
domain { name = "peps.python.org" }
backend {
name = "GitHub Pages"
address = "python.github.io"
port = 443
override_host = "peps.python.org"
use_ssl = true
ssl_check_cert = true
ssl_cert_hostname = "python.github.io"
ssl_sni_hostname = "python.github.io"
}
header {
name = "HSTS"
type = "response"
action = "set"
destination = "http.Strict-Transport-Security"
ignore_if_set = false
source = "\"max-age=31536000; includeSubDomains; preload\""
}
request_setting {
name = "Force TLS"
force_ssl = true
}
snippet {
name = "serve-rss"
type = "recv"
content = <<-EOT
if (req.url == "/peps.rss/") {
set req.url = "/peps.rss";
}
EOT
}
snippet {
name = "topics"
type = "recv"
content = <<-EOT
if (req.url ~ "^/topics($|/)") {
set req.http.Location = regsub(req.http.Location, "^/topics/?", "/topic/");
error 618;
}
EOT
}
snippet {
name = "redirect"
type = "error"
content = <<-EOT
if (obj.status == 618) {
set obj.status = 302;
set obj.http.Location = "https://" + req.http.host + req.http.Location;
return(deliver);
}
EOT
}
snippet {
name = "redirect-numbers"
type = "recv"
content = <<-EOT
if (req.url ~ "^/(\d|\d\d|\d\d\d|\d\d\d\d)/?$") {
set req.http.Location = "/pep-" + std.strpad(re.group.1, 4, "0") + "/";
error 618;
}
EOT
}
snippet {
name = "left-pad-pep-numbers"
type = "recv"
content = <<-EOT
if (req.url ~ "^/pep-(\d|\d\d|\d\d\d)/?$") {
set req.http.Location = "/pep-" + std.strpad(re.group.1, 4, "0") + "/";
error 618;
}
EOT
}
}