File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 3434
3535# Determine if the URL needs conversion by checking if it contains non-ASCII characters.
3636map $uri $needs_conversion {
37- ~[^\x00-\x7F] "yes";
38- default "no";
37+ ~[^\x00-\x7F] "yes";
38+ default "no";
3939}
4040
4141server {
@@ -98,8 +98,9 @@ server {
9898 -- First check for Medium ID and remove it before processing
9999 local has_medium_id = string.match(ngx.var.uri, "/(.*)-([%x][%x][%x][%x][%x][%x][%x][%x][%x][%x][%x]?[%x]?)$")
100100 if has_medium_id then
101- -- Remove Medium ID and redirect to the cleaned URL
101+ -- Remove Medium ID
102102 local clean_path = string.gsub(ngx.var.uri, "/(.*)-([%x][%x][%x][%x][%x][%x][%x][%x][%x][%x][%x]?[%x]?)$", "/%1")
103+ -- Permanent redirect since the Medium ID doesn't mean much on any other platform
103104 ngx.redirect(clean_path, 301)
104105 return
105106 end
@@ -150,7 +151,8 @@ server {
150151 local converted_path = convert_string(original_path)
151152
152153 -- Redirect to the converted path
153- ngx.redirect("/" .. converted_path, 301)
154+ -- Only do a temporary redirect allowing us to revert to ASCII URLs in future
155+ ngx.redirect("/" .. converted_path, 307)
154156 return
155157 end
156158 }
@@ -177,7 +179,7 @@ server {
177179}
178180
179181upstream {{ .APP }} {
180- {{ range .DOKKU_APP_WEB_LISTENERS | split " " }}
181- server {{ . }};
182- {{ end }}
182+ {{ range .DOKKU_APP_WEB_LISTENERS | split " " }}
183+ server {{ . }};
184+ {{ end }}
183185}
You can’t perform that action at this time.
0 commit comments