From 307685c44e41946c2ba9cb64e38719cd8a8c9a59 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 3 Nov 2024 15:54:47 +0100 Subject: [PATCH] configure redirects for legacy urls --- fly/applications/caddy/Caddyfile | 36 +++++++++++++++++++++++++------ fly/applications/caddy/Dockerfile | 4 ++++ fly/applications/caddy/fly.toml | 7 +++--- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 fly/applications/caddy/Dockerfile diff --git a/fly/applications/caddy/Caddyfile b/fly/applications/caddy/Caddyfile index 17e557b..ef4cc56 100644 --- a/fly/applications/caddy/Caddyfile +++ b/fly/applications/caddy/Caddyfile @@ -1,12 +1,34 @@ +# { +# auto_https off +# } +{ + log { + level DEBUG + } +} :8080 { # redirect Rogue Scholar legacy URLs - @blogs path /blogs /blogs/* - @posts path /posts /posts/* - @lang path /en /en/* /de /de/* /es /es/* /fr /fr/* /it /it/* /pt /pt/* /tr /tr/* + route { + @posts path /posts/* + @lang path /en/* /de/* /es/* /fr/* /it/* /pt/* /tr/* + @legacy path /about /board + + redir @posts https://legacy.rogue-scholar.org{uri} + redir @lang https://legacy.rogue-scholar.org{uri} + redir @legacy https://legacy.rogue-scholar.org{uri} - redir @blogs https://legacy.rogue-scholar.org{uri} - redir @posts https://legacy.rogue-scholar.org{uri} - redir @lang https://legacy.rogue-scholar.org{uri} + uri replace /en / + uri replace /de / + uri replace /es / + uri replace /fr / + uri replace /it / + uri replace /pt / + uri replace /tr / + uri replace /posts / + uri replace /blogs /communities + uri replace /blogs/* /communities/* - redir / https://rogue-scholar.org{uri} + redir https://beta.rogue-scholar.org{uri} + # reverse_proxy 66.241.124.87 + } } diff --git a/fly/applications/caddy/Dockerfile b/fly/applications/caddy/Dockerfile new file mode 100644 index 0000000..b706276 --- /dev/null +++ b/fly/applications/caddy/Dockerfile @@ -0,0 +1,4 @@ +FROM caddy:2.8.4 + +COPY ./Caddyfile /etc/caddy/Caddyfile + diff --git a/fly/applications/caddy/fly.toml b/fly/applications/caddy/fly.toml index 1cbb36f..96aea19 100644 --- a/fly/applications/caddy/fly.toml +++ b/fly/applications/caddy/fly.toml @@ -6,9 +6,6 @@ app = 'rogue-scholar-caddy' primary_region = 'fra' -[build] - image = 'caddy:2.8.4' - [http_service] internal_port = 8080 force_https = true @@ -21,3 +18,7 @@ primary_region = 'fra' memory = '1gb' cpu_kind = 'shared' cpus = 1 + +[mounts] + source = "caddy_data" + destination = "/data"