如何使用undertow将非www URL重定向到jboss中的www URL
Posted
技术标签:
【中文标题】如何使用undertow将非www URL重定向到jboss中的www URL【英文标题】:How to redirect non www URL to www URL in jboss using undertow 【发布时间】:2021-11-30 08:11:56 【问题描述】:如何使用undertow
将非www URL 重定向到jboss
中的www URL。
用下面的命令试过,重定向太多了。
/subsystem=undertow/configuration=filter/rewrite=nonwww-to-www:add(redirect="true",target="https://www.localhost:8443%U")
/subsystem=undertow/server=default-server/host=default-host/filter-ref=nonwww-to-www:add(predicate="regex(pattern=^https://localhost:8443,value=https://localhost:8443,full-match=false)")
【问题讨论】:
【参考方案1】:不一样,这个在JBoss
关注HTTP to HTTPS,不过接受的回答还是蛮详细的,说不定对你有帮助:
https://***.com/a/43752373/14076903
我引用:
“重写规则可用于重定向用户。在 undertow 子系统(standalone.xml
或 domain.xml
)中,您需要创建新的重写过滤器,然后在新的 fitler-ref
中启用过滤器。”
【讨论】:
我有一个问题是在下面的正则表达式中使用什么。 (predicate="regex(pattern=^localhost:8443,value=https://…)以上是关于如何使用undertow将非www URL重定向到jboss中的www URL的主要内容,如果未能解决你的问题,请参考以下文章