Skip to content

Commit

Permalink
Remove VCL conditionals for GOV.UK Chat
Browse files Browse the repository at this point in the history
GOV.UK Chat is being deintegrated from www.gov.uk now that the private
beta has concluded. This removes the additional VCL configuration from
Fastly.
  • Loading branch information
kevindew committed Feb 6, 2025
1 parent a543c20 commit 3679874
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
2 changes: 0 additions & 2 deletions www/service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ locals {
minimum_tls_version = "1.2"
ssl_ciphers = "ECDHE-RSA-AES256-GCM-SHA384"
basic_authentication = null
disable_chat = false
chat_path_regex = "^/chat(/.*)?$" # matches /chat and /chat/*

s3_static_assets_port = 443
s3_static_assets_hostname = null
Expand Down
26 changes: 0 additions & 26 deletions www/www.vcl.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -363,20 +363,6 @@ sub vcl_recv {

${indent(2, ab_tests_rendered)}

# Strip cookies for requests to GOV.UK Chat URLs that lack a session cookie,
# otherwise pass through
if (req.url.path ~ "${chat_path_regex}") {
if (req.http.cookie:_govuk_chat_session) {
return(pass);
# These endpoints make use of HEAD requests and we don't want these
# to be converted to GET requests (https://www.fastly.com/documentation/reference/vcl/subroutines/recv/)
} elsif (req.url ~ "^/chat/(sign-in|unsubscribe)" && req.request == "HEAD") {
return(pass);
} else {
unset req.http.Cookie;
}
}

# Strip cookies from inbound requests. Corresponding rule in vcl_fetch{}
# For simplicity and security most applications should not use cookies.
# With the exception of:
Expand All @@ -387,13 +373,6 @@ sub vcl_recv {
unset req.http.Cookie;
}

%{ if disable_chat == true ~}
# Chat app is disabled
if (req.url.path ~ "${chat_path_regex}") {
error 503 "Service unavailable";
}
%{ endif ~}

if (req.url.path ~ "^\/assets(\/.*)?\z") {
set req.backend = F_staticAssetsS3;
set req.http.host = "${s3_static_assets_hostname}";
Expand Down Expand Up @@ -510,11 +489,6 @@ sub vcl_fetch {
}
}

# We don't want to cache any GOV.UK Chat responses that set a cookie
if (req.url.path ~ "${chat_path_regex}" && beresp.http.Set-Cookie) {
return (pass);
}

# Strip cookies from outbound requests. Corresponding rule in vcl_recv{}
if (req.url !~ "^/(apply-for-a-licence|email|sign-in/callback/)") {
unset beresp.http.Set-Cookie;
Expand Down

0 comments on commit 3679874

Please sign in to comment.