From 152e7f1018aed2e98a1fe48668c7cf34e741c143 Mon Sep 17 00:00:00 2001 From: Tim Siegel Date: Tue, 24 Sep 2024 14:42:57 -0400 Subject: [PATCH] fix: redirect static /doc/master on fastly also --- .../release-distribution/fastly-static.tf | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/terragrunt/modules/release-distribution/fastly-static.tf b/terragrunt/modules/release-distribution/fastly-static.tf index e3a21fe9..760c4f78 100644 --- a/terragrunt/modules/release-distribution/fastly-static.tf +++ b/terragrunt/modules/release-distribution/fastly-static.tf @@ -115,6 +115,26 @@ resource "fastly_service_vcl" "static" { VCL } + snippet { + # This was an abandoned copy of Rust 1.17.0-era docs; redirect to current docs + name = "redirect /doc/master to /stable" + type = "error" + content = <<-VCL + if (req.url ~ "^\/doc/master(\/|$)")?$") { + set obj.status = 301; + set obj.response = "Moved permanently"; + set obj.http.Location = regsub(req.url, "^\/doc\/master", "https://doc.rust-lang.org/stable"); + + synthetic {" + #!/bin/bash + echo "The documentation now lives under doc.rust-lang.org" + "}; + + return (deliver); + } + VCL + } + logging_datadog { name = "datadog" token = data.aws_ssm_parameter.datadog_api_key.value