我已经在子系统标记中以这种方式配置了standalone.xml文件:
<rewrite name="rule-2" pattern="^((?!.*(rest)).*)\/([\w\-]+)\/([\w\-]+)$" substitution="/$1/index.html" flags="L"/>
<rewrite name="rule-3" pattern="^((?!.*(rest)).*)\/([\w\-]+)$" substitution="/$1/index.html" flags="L"/>我应该将所有的url重定向到索引,让那些包含单词"rest“的通过,我认为这些正则表达式必须工作,但我得到一个空白页面刷新没有错误。我已经这样设置了base-href :/ myApp /
使用这两种正则表达式:
rewrite name="rule-1" pattern="^/(.*)/([\w\-]+)/([\w\-]+)$" substitution="/$1/index.html" flags="L"/>
<rewrite name="rule-2" pattern="^/(.*)/([\w\-]+)$" substitution="/$1/index.html" flags="L"/>一切正常,但包含单词"rest“的所有URL也被重定向,因此后端调用不起作用
发布于 2019-08-30 11:58:09
首先:要验证您的正则表达式模式,请使用工具,例如。https://regex101.com
第二:在第一条规则中,排除如下:!.*(rest))因此,对于您还需要添加排除或条件。
Cli命令为Jboss web应用规则:
#/subsystem=web/virtual-server=default-host/rewrite=jboss:add(pattern="^/$", substitution="/example/", flags="L,R=302")第三:关于刷新,对于JBoss中的任何属性,都必须使用CLI命令重新加载服务器
:重新加载
希望这能有所帮助
https://stackoverflow.com/questions/57706972
复制相似问题