fix(traefik): redirect root domain to Free Flow

Redirect requests made to the root domain to Free Flow.
This commit is contained in:
Dan Anglin 2023-08-01 02:45:28 +01:00
parent 032c080b99
commit 9e24f50653
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
3 changed files with 22 additions and 1 deletions

View file

@ -2,6 +2,8 @@ FROM traefik:{{ .Traefik.Version }}
ADD traefik.yaml /flow/traefik/
ADD dynamic_root_domain_redirect.yaml /tmp/dynamic_root_domain_redirect.yaml
ADD entrypoint.sh /
RUN chmod +x /entrypoint.sh

View file

@ -0,0 +1,18 @@
---
http:
routers:
root-domain:
entryPoints:
- "https"
rule: "Host(`{{ .RootDomain }}`)"
middlewares:
- "redirect-root-to-freeflow"
service: noop@internal
tls:
certResolver: resolver
middlewares:
redirect-root-to-freeflow:
redirectRegex:
regex: "^(.*)"
replacement: "https://{{ .GoToSocial.Subdomain }}.{{ .RootDomain }}"
permanent: true

View file

@ -8,7 +8,8 @@ chgrp {{ .FlowGID }} {{ .Traefik.SharedMountPoint }}/dynamic
chmod a-rwx,u+rwx,g+rwx {{ .Traefik.SharedMountPoint }}/dynamic
# Move any dynamic config to the new directory.
for f in $( find /tmp -mindepth 1 -maxdepth 1 -type f -iname '*dynamic*.yaml' -exec basename {} \; ); do
for f in $( find /tmp -mindepth 1 -maxdepth 1 -type f -iname 'dynamic*.yaml' -exec basename {} \; ); do
echo "INFO: Moving /tmp/${f} to {{ .Traefik.SharedMountPoint }}/dynamic/${f}..."
mv -f /tmp/${f} {{ .Traefik.SharedMountPoint }}/dynamic/${f}
done