From 48cde20abe403dc923643d76f369e03102ad5c54 Mon Sep 17 00:00:00 2001 From: Dale Frey Date: Thu, 2 Jan 2025 13:37:57 -0500 Subject: [PATCH] USAGOV-2016-v3: USAGOV-2016 nginx redirects --- .../etc/nginx/partials/internal_redirects.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.docker/src-www/etc/nginx/partials/internal_redirects.conf b/.docker/src-www/etc/nginx/partials/internal_redirects.conf index 141aa6b16b..7ea9b2f361 100644 --- a/.docker/src-www/etc/nginx/partials/internal_redirects.conf +++ b/.docker/src-www/etc/nginx/partials/internal_redirects.conf @@ -1,5 +1,19 @@ # Proxy directives for the public site. May be included in CMS for local/cms testing + location / { + # Decode the URI for proper matching + set $decoded_uri $uri; + if ($decoded_uri ~* ^(.+?)(%C2%A0|\xA0|%E2%80%89|\xE2\x80\x89|%E2%80%83|\xE2\x80\x83)+$) { + set $clean_uri $1; + return 301 $clean_uri; + } + # Match and strip other partial %C2 sequences from the end of the URI + if ($uri ~* ^(.+?)(%C2|\xC2)+$) { + set $clean_uri $1; + return 301 $clean_uri; + } + } + # Federal and state directory PERMANENT redirects: rewrite ^/federal-agencies/a$ /agency-index permanent; rewrite ^/federal-agencies/([^/])$ /agency-index/$1 permanent;