@@ -4,7 +4,7 @@ resource "fastly_service_vcl" "python_org" {
4
4
http3 = false
5
5
stale_if_error = false
6
6
stale_if_error_ttl = 43200
7
- activate = true
7
+ activate = false
8
8
9
9
domain {
10
10
name = var. domain
@@ -32,13 +32,14 @@ resource "fastly_service_vcl" "python_org" {
32
32
connect_timeout = 1000
33
33
first_byte_timeout = 30000
34
34
between_bytes_timeout = 10000
35
- override_host = " www.python.org"
35
+ override_host = var . subdomain == " test.python.org " ? " www.python.org" : null
36
36
}
37
37
38
38
backend {
39
39
name = " loadbalancer"
40
40
address = " lb.nyc1.psf.io"
41
- shield = " iad-va-us"
41
+ port = 20004
42
+ shield = " lga-ny-us"
42
43
healthcheck = " HAProxy Status"
43
44
auto_loadbalance = false
44
45
use_ssl = true
@@ -51,7 +52,7 @@ resource "fastly_service_vcl" "python_org" {
51
52
connect_timeout = 1000
52
53
first_byte_timeout = 15000
53
54
between_bytes_timeout = 10000
54
- override_host = var. domain == " test.python.org" ? " www.python.org" : null
55
+ override_host = var. subdomain == " test.python.org" ? " www.python.org" : null
55
56
}
56
57
57
58
acl {
@@ -82,7 +83,7 @@ resource "fastly_service_vcl" "python_org" {
82
83
condition {
83
84
name = " HSTS w/ subdomains"
84
85
priority = 10
85
- statement = " req.http.host == \" ${ var . domain } \" "
86
+ statement = " req.http.host == \" ${ var . subdomain } \" "
86
87
type = " RESPONSE"
87
88
}
88
89
condition {
@@ -191,7 +192,7 @@ resource "fastly_service_vcl" "python_org" {
191
192
name = " www redirect"
192
193
priority = 10
193
194
response_condition = " apex redirect"
194
- source = " \" https://www. \" + req.http.host + req.url"
195
+ source = " \" https://${ var . subdomain } \" + req.url"
195
196
type = " response"
196
197
}
197
198
header {
@@ -255,10 +256,10 @@ resource "fastly_service_vcl" "python_org" {
255
256
name = " psf-fastly-logs"
256
257
bucket_name = " psf-fastly-logs-eu-west-1"
257
258
domain = " s3-eu-west-1.amazonaws.com"
258
- path = " /${ replace (var. domain , " ." , " -" )} /%Y/%m/%d/"
259
+ path = " /${ replace (var. subdomain , " ." , " -" )} /%Y/%m/%d/"
259
260
period = 3600
260
261
gzip_level = 9
261
- format = " %% h \" %%{now}V\" %% l \" %%{req.request}V %%{req.url}V\" %%{req.proto}V % %>s %%{resp.http.Content-Length}V %%{resp.http.age}V \" %%{resp.http.x-cache}V\" \" %%{resp.http.x-cache-hits}V\" \" %%{req.http.content-type}V\" \" %%{req.http.accept-language}V\" \" %%{cstr_escape(req.http.user-agent)}V\" "
262
+ format = " %h \" %%{now}V\" %l \" %%{req.request}V %%{req.url}V\" %%{req.proto}V %>s %%{resp.http.Content-Length}V %%{resp.http.age}V \" %%{resp.http.x-cache}V\" \" %%{resp.http.x-cache-hits}V\" \" %%{req.http.content-type}V\" \" %%{req.http.accept-language}V\" \" %%{cstr_escape(req.http.user-agent)}V\" "
262
263
timestamp_format = " %Y-%m-%dT%H:%M:%S.000"
263
264
redundancy = " standard"
264
265
format_version = 2
@@ -271,7 +272,7 @@ resource "fastly_service_vcl" "python_org" {
271
272
name = " syslog"
272
273
address = " cdn-logs.nyc1.psf.io"
273
274
port = 514
274
- format = " %% h \" %%{now}V\" %% l \" %%{req.request}V %%{req.url}V\" %%{req.proto}V % %>s %%{resp.http.Content-Length}V %%{resp.http.age}V \" %%{resp.http.x-cache}V\" \" %%{resp.http.x-cache-hits}V\" \" %%{req.http.content-type}V\" \" %%{req.http.accept-language}V\" \" %%{cstr_escape(req.http.user-agent)}V\" "
275
+ format = " %h \" %%{now}V\" %l \" %%{req.request}V %%{req.url}V\" %%{req.proto}V %>s %%{resp.http.Content-Length}V %%{resp.http.age}V \" %%{resp.http.x-cache}V\" \" %%{resp.http.x-cache-hits}V\" \" %%{req.http.content-type}V\" \" %%{req.http.accept-language}V\" \" %%{cstr_escape(req.http.user-agent)}V\" "
275
276
}
276
277
277
278
product_enablement {
@@ -296,15 +297,15 @@ resource "fastly_service_vcl" "python_org" {
296
297
297
298
response {
298
299
content = <<- EOT
299
- <html>
300
- <head>
301
- <title>Too Many Requests</title>
302
- </head>
303
- <body>
304
- <p>Too Many Requests</p>
305
- </body>
306
- </html>
307
- EOT
300
+ <html>
301
+ <head>
302
+ <title>Too Many Requests</title>
303
+ </head>
304
+ <body>
305
+ <p>Too Many Requests</p>
306
+ </body>
307
+ </html>
308
+ EOT
308
309
content_type = " text/html"
309
310
status = 429
310
311
}
@@ -341,6 +342,4 @@ resource "fastly_service_vcl" "python_org" {
341
342
response = " Forbidden"
342
343
status = 403
343
344
}
344
-
345
- force_destroy = true
346
345
}
0 commit comments