diff --git a/compose-demo01-jib.yml b/compose-demo01-jib.yml index 1247908..7c536c4 100644 --- a/compose-demo01-jib.yml +++ b/compose-demo01-jib.yml @@ -34,14 +34,20 @@ services: # 定义SSL,entrypoints=web-ssl,接受https请求,路由和服务要重新定义一次 - "traefik.http.routers.demo01-jib-ssl.tls=true" - "traefik.http.routers.demo01-jib-ssl.entrypoints=web-ssl" - - "traefik.http.routers.demo01-jib-ssl.rule=PathPrefix(`/demo01`)" + - "traefik.http.routers.demo01-jib-ssl.rule=Host(`www.dingzhaojun.top`) && PathPrefix(`/demo01`)" - "traefik.http.routers.demo01-jib-ssl.service=demo01" - # HTTP 协议自动跳转 HTTPS - #- "traefik.http.middlewares.to-https.redirectscheme.scheme=https" - #- "traefik.http.middlewares.to-https.redirectscheme.permanent=true" - #- "traefik.http.middlewares.to-https.redirectscheme.port=7443" - #- "traefik.http.routers.demo01-jib.middlewares=to-https" + # 定义URL重定向中间件switch-domain,将http://localhost转换为https://www.dingzhaojun.top + - "traefik.http.middlewares.switch-domain.redirectregex.regex=^http://localhost(.*)" + - "traefik.http.middlewares.switch-domain.redirectregex.replacement=http://www.dingzhaojun.top$$1" + + # 定义URL中的scheme、port重定向中间件to-https,将http转换为https,8081转换为7443,但不转换IP地址部分 + - "traefik.http.middlewares.to-https.redirectscheme.scheme=https" + - "traefik.http.middlewares.to-https.redirectscheme.permanent=true" + - "traefik.http.middlewares.to-https.redirectscheme.port=7443" + + # 设置路由demo01-jib使用的中间件 + - "traefik.http.routers.demo01-jib.middlewares=switch-domain" networks: y9-share-net: diff --git a/compose-demo01-jvm.yml b/compose-demo01-jvm.yml index d56955d..9d8181d 100644 --- a/compose-demo01-jvm.yml +++ b/compose-demo01-jvm.yml @@ -34,15 +34,21 @@ services: # 定义SSL,entrypoints=web-ssl,接受https请求,路由和服务要重新定义一次 - "traefik.http.routers.demo01-jvm-ssl.tls=true" - "traefik.http.routers.demo01-jvm-ssl.entrypoints=web-ssl" - - "traefik.http.routers.demo01-jvm-ssl.rule=PathPrefix(`/demo01`)" + - "traefik.http.routers.demo01-jvm-ssl.rule=Host(`www.dingzhaojun.top`) && PathPrefix(`/demo01`)" - "traefik.http.routers.demo01-jvm-ssl.service=demo01" - # HTTP 协议自动跳转 HTTPS - #- "traefik.http.middlewares.to-https.redirectscheme.scheme=https" - #- "traefik.http.middlewares.to-https.redirectscheme.permanent=true" - #- "traefik.http.middlewares.to-https.redirectscheme.port=7443" - #- "traefik.http.routers.demo01-jib.middlewares=to-https" + # 定义URL重定向中间件switch-domain,将http://localhost转换为https://www.dingzhaojun.top + - "traefik.http.middlewares.switch-domain.redirectregex.regex=^http://localhost(.*)" + - "traefik.http.middlewares.switch-domain.redirectregex.replacement=http://www.dingzhaojun.top$$1" + + # 定义URL中的scheme、port重定向中间件to-https,将http转换为https,8081转换为7443,但不转换IP地址部分 + - "traefik.http.middlewares.to-https.redirectscheme.scheme=https" + - "traefik.http.middlewares.to-https.redirectscheme.permanent=true" + - "traefik.http.middlewares.to-https.redirectscheme.port=7443" + + # 设置路由demo01-jib使用的中间件 + - "traefik.http.routers.demo01-jib.middlewares=switch-domain" networks: y9-share-net: diff --git a/compose-demo01-native.yml b/compose-demo01-native.yml index 4151bdc..bb11f06 100644 --- a/compose-demo01-native.yml +++ b/compose-demo01-native.yml @@ -34,14 +34,20 @@ services: # 定义SSL,entrypoints=web-ssl,接受https请求,路由和服务要重新定义一次 - "traefik.http.routers.demo01-native-ssl.tls=true" - "traefik.http.routers.demo01-native-ssl.entrypoints=web-ssl" - - "traefik.http.routers.demo01-native-ssl.rule=PathPrefix(`/demo01`)" + - "traefik.http.routers.demo01-native-ssl.rule=Host(`www.dingzhaojun.top`) && PathPrefix(`/demo01`)" - "traefik.http.routers.demo01-native-ssl.service=demo01" - # HTTP 协议自动跳转 HTTPS - #- "traefik.http.middlewares.to-https.redirectscheme.scheme=https" - #- "traefik.http.middlewares.to-https.redirectscheme.permanent=true" - #- "traefik.http.middlewares.to-https.redirectscheme.port=7443" - #- "traefik.http.routers.demo01-jib.middlewares=to-https" + # 定义URL重定向中间件switch-domain,将http://localhost转换为https://www.dingzhaojun.top + - "traefik.http.middlewares.switch-domain.redirectregex.regex=^http://localhost(.*)" + - "traefik.http.middlewares.switch-domain.redirectregex.replacement=http://www.dingzhaojun.top$${1}" + + # 定义URL中的scheme、port重定向中间件to-https,将http转换为https,8081转换为7443,但不转换IP地址部分 + - "traefik.http.middlewares.to-https.redirectscheme.scheme=https" + - "traefik.http.middlewares.to-https.redirectscheme.permanent=true" + - "traefik.http.middlewares.to-https.redirectscheme.port=7443" + + # 设置路由demo01-jib使用的中间件 + - "traefik.http.routers.demo01-jib.middlewares=switch-domain" networks: y9-share-net: