Skip to content

Commit

Permalink
create error 619
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoIeni committed Nov 26, 2024
1 parent d579a99 commit cdd0f7b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion terragrunt/modules/release-distribution/fastly-static.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ resource "fastly_service_vcl" "static" {
VCL
}

snippet {
name = "detect doc/master requests"
type = "recv"
content = <<-VCL
if (req.url ~ "^\/doc\/master\/") {
error 619 "redirect";
}
VCL
}

snippet {
name = "enable segmented caching"
type = "recv"
Expand Down Expand Up @@ -120,7 +130,7 @@ resource "fastly_service_vcl" "static" {
name = "redirect /doc/master to /stable"
type = "error"
content = <<-VCL
if (req.url ~ "^\/doc/master(\/|$)")?$") {
if (obj.status == 619 && obj.response == "redirect") {
set obj.status = 301;
set obj.response = "Moved permanently";
set obj.http.Location = regsub(req.url, "^\/doc\/master", "https://doc.rust-lang.org/stable");
Expand Down

0 comments on commit cdd0f7b

Please sign in to comment.