【发布时间】:2019-01-12 17:24:14
【问题描述】:
对于我对 Traefik 的新手理解,我提前道歉,但有没有办法使用基于请求的变量重写为“非 www”域?
我已经在谷歌上搜索了一个多小时,但找不到答案。
这是我在 Apache 中如何执行此操作的示例。你可以看到它正在使用HTTP_HOST 变量:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
我可以看到我可以这样设置标签:
--label "traefik.frontend.redirect.permanent=true"
--label "traefik.frontend.redirect.regex=^https?://www.example.com/(.*)"
--label "traefik.frontend.redirect.replacement=https://example.com/${1}"
但这需要我为所有内容设置example.com。无论域如何,我都希望它重定向。谢谢!
【问题讨论】:
标签: traefik