diff --git a/modules/www/www.vcl.tftpl b/modules/www/www.vcl.tftpl index 361aab7..465b040 100644 --- a/modules/www/www.vcl.tftpl +++ b/modules/www/www.vcl.tftpl @@ -199,6 +199,14 @@ sub vcl_recv { if (!req.http.Fastly-SSL) { error 801 "Force SSL"; } + + # Temporary if statement to test changes before going to production: + %{ if environment == "integration" } + # Reject HTTP requests which don't use a standard method + if (req.method !~ "^(GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH|FASTLYPURGE)") { + error 805 "Method not allowed"; + } + %{ endif ~} %{ if private_extra_vcl_recv != "" ~} ${private_extra_vcl_recv} @@ -559,6 +567,32 @@ sub vcl_error { return (deliver); } + if (obj.status == 805) { + set obj.status = 405; + set obj.response = "Method not allowed"; + set obj.http.Fastly-Backend-Name = "force_method_not_allowed"; + + synthetic {" + + +
+We cannot find the page you're looking for. Please try searching on GOV.UK.
+ + "}; + + return (deliver); + } + ${indent(2, file("${module_path}/../shared/_security_txt_response.vcl"))} %{ if basic_authentication != null }