Skip to content

Commit 7ca5680

Browse files
Updates
1 parent 3019168 commit 7ca5680

File tree

5 files changed

+69
-8
lines changed

5 files changed

+69
-8
lines changed

protect-cached-content/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ resource "fastly_service_vcl" "frontend-vcl-service" {
88
name = "Frontend VCL Service - NGWAF edge deploy ${var.USER_VCL_SERVICE_DOMAIN_NAME}"
99

1010
product_enablement {
11-
origin_inspector = true
12-
domain_inspector = true
13-
bot_management = true
11+
origin_inspector = true
12+
domain_inspector = true
13+
bot_management = true
14+
log_explorer_insights = true
1415
}
1516

1617
domain {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#### Fastly VCL Service - Start
2+
resource "fastly_service_vcl" "noop-vcl-service" {
3+
name = "Frontend VCL Service - NGWAF edge deploy ${var.USER_NOOP_SERVICE_DOMAIN_NAME}"
4+
5+
product_enablement {
6+
origin_inspector = true
7+
domain_inspector = true
8+
bot_management = true
9+
log_explorer_insights = true
10+
}
11+
domain {
12+
name = var.USER_NOOP_SERVICE_DOMAIN_NAME
13+
comment = "Frontend VCL Service - NGWAF edge deploy"
14+
}
15+
16+
snippet {
17+
name = "noop response caching"
18+
content = file("${path.module}/vcl/noop.vcl")
19+
type = "init"
20+
priority = 100
21+
}
22+
23+
force_destroy = true
24+
}
25+
26+
output "noop_output" {
27+
value = <<tfmultiline
28+
29+
#### Click the URL to go to the Fastly VCL service ####
30+
https://cfg.fastly.com/${fastly_service_vcl.noop-vcl-service.id}
31+
32+
tfmultiline
33+
34+
description = "Output hints on what to do next."
35+
}
36+

protect-cached-content/variables.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ variable "USER_VCL_SERVICE_DOMAIN_NAME" {
1414
variable "USER_VCL_SERVICE_BACKEND_HOSTNAME" {
1515
type = string
1616
description = "hostname used for backend."
17-
default = "http-me.glitch.me"
17+
default = "http.edgecompute.app"
18+
}
19+
20+
variable "USER_NOOP_SERVICE_DOMAIN_NAME" {
21+
type = string
22+
description = "noop service."
1823
}
1924

2025
#### VCL Service variables - End

protect-cached-content/vcl/ngwaf_caching.vcl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@ backend F_noop_origin {
55
.between_bytes_timeout = 10s;
66
.connect_timeout = 1s;
77
.first_byte_timeout = 1s;
8-
.host = "127.0.0.1";
8+
.host = "noop-caching.global.ssl.fastly.net";
99
.max_connections = 200;
1010
.port = "443";
1111
.ssl = true;
1212
.max_tls_version = "1.3";
13-
.min_tls_version = "1.3";
14-
.ssl_cert_hostname = "127.0.0.1";
13+
.min_tls_version = "1.1";
14+
.ssl_cert_hostname = "noop-caching.global.ssl.fastly.net";
1515
.ssl_check_cert = always;
16-
.ssl_sni_hostname = "127.0.0.1";
16+
.ssl_sni_hostname = "noop-caching.global.ssl.fastly.net";
17+
.probe = {
18+
.dummy = true;
19+
.initial = 5;
20+
.request = "HEAD / HTTP/1.1" "Host: noop-caching.global.ssl.fastly.net" "Connection: close";
21+
.threshold = 1;
22+
.timeout = 2s;
23+
.window = 5;
24+
}
1725
}
1826

1927
# force cluster for all requests and on restarts. https://www.fastly.com/documentation/guides/vcl/clustering/#enabling-and-disabling-clustering

protect-cached-content/vcl/noop.vcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
sub vcl_recv {
2+
error 600;
3+
}
4+
5+
sub vcl_error {
6+
if (obj.status == 600) {
7+
set obj.status = 200;
8+
set obj.response = "OK";
9+
return (deliver);
10+
}
11+
}

0 commit comments

Comments
 (0)