Update Traefik configuration to remove www subdomain redirect

This commit is contained in:
2024-02-28 20:15:38 +08:00
parent 396b81bbe9
commit c499b3d874
2 changed files with 13 additions and 10 deletions
+11 -6
View File
@@ -52,12 +52,13 @@ http:
# - "*.furyhawk.lol" # - "*.furyhawk.lol"
web-secure-router: web-secure-router:
rule: "Host(`furyhawk.lol`, `www.furyhawk.lol`, `bai.furyhawk.lol`) || PathPrefix(`/bai`)" rule: "Host(`furyhawk.lol`, `www.furyhawk.lol`, `bai.furyhawk.lol`)"
entryPoints: entryPoints:
- web-secure - web-secure
middlewares: middlewares:
- csrf - csrf
- add-bai - no-www
# - add-bai
service: streamlit_bai_app service: streamlit_bai_app
tls: tls:
# https://docs.traefik.io/master/routing/routers/#certresolver # https://docs.traefik.io/master/routing/routers/#certresolver
@@ -72,7 +73,7 @@ http:
- web-secure - web-secure
middlewares: middlewares:
- csrf - csrf
- add-fin # - add-fin
service: streamlit_fin_app service: streamlit_fin_app
tls: tls:
# https://docs.traefik.io/master/routing/routers/#certresolver # https://docs.traefik.io/master/routing/routers/#certresolver
@@ -119,7 +120,11 @@ http:
# https://docs.djangoproject.com/en/dev/ref/csrf/#ajax # https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
headers: headers:
hostsProxyHeaders: ["X-CSRFToken"] hostsProxyHeaders: ["X-CSRFToken"]
no-www:
redirectRegex:
regex: "^https?://www\\.(.+)"
replacement: https://${1}
permanent: true
add-bai: add-bai:
addPrefix: addPrefix:
prefix: "/bai" prefix: "/bai"
@@ -143,11 +148,11 @@ http:
streamlit_bai_app: streamlit_bai_app:
loadBalancer: loadBalancer:
servers: servers:
- url: http://streamlit_bai_app:8502/bai - url: http://streamlit_bai_app:8502
streamlit_fin_app: streamlit_fin_app:
loadBalancer: loadBalancer:
servers: servers:
- url: http://streamlit_fin_app:8501/fin - url: http://streamlit_fin_app:8501
blog: blog:
loadBalancer: loadBalancer:
servers: servers:
+2 -4
View File
@@ -4,12 +4,10 @@ x-environment: &default-environment
LOG_LEVEL: "DEBUG" LOG_LEVEL: "DEBUG"
LOG_PATH: "./logs" LOG_PATH: "./logs"
ACME_PATH: "./acme.json" ACME_PATH: "./acme.json"
DASHBOARD_USER: "${DASHBOARD_USER}"
DASHBOARD_PASSWORD: "${DASHBOARD_PASSWORD}"
NETWORK: "${NETWORK:-web}" NETWORK: "${NETWORK:-web}"
FIN_LOCATION: "/fin" FIN_LOCATION: "/"
STREAMLIT_FIN_SERVER_PORT: "8501" STREAMLIT_FIN_SERVER_PORT: "8501"
BAI_LOCATION: "/bai" BAI_LOCATION: "/"
STREAMLIT_BAI_SERVER_PORT: "8502" STREAMLIT_BAI_SERVER_PORT: "8502"
volumes: volumes: