url-rewriting - 使用 Wildfly 独立处理程序重定向我的 url 时如何设置占位符?
问题描述
我正在尝试使用 Standalone.xml 中的以下设置重定向我的 URL:
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/en/" handler="en"/>
<location name="/de/" handler="de"/>
<location name="/" handler="de"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="en" path="${jboss.home.dir}/standalone/deployments/en"/>
<file name="de" path="${jboss.home.dir}/standalone/deployments/de"/>
</handlers>
我的处理程序指向 Wildfly 服务器的部署文件夹中匹配的 Angular 前端项目,其中也部署了我的 EAR 文件。
这工作正常,除了一种情况:如果我刷新我的详细信息页面,它看起来像这样:localhost:8080/en/details/1234
我收到一个错误
404 - Page not found 我已经尝试过
<location name="/en/details/1234" handler="en"/>
哪个有效,但显然只适用于那个特定的 id。
据我了解,这可以通过添加类似的东西来解决
<location name="/en/details/(.*)" handler="en"/>
我的问题是我无法弄清楚如何在“详细信息/”之后放置一个像正则表达式这样的占位符。这甚至可能吗?或者有没有更好的方法来处理这个重定向/重写问题?
我已经试undertow-handlers.conf
了一下,但感觉它从未真正触发我在那里实施的重写规则。
解决方案
推荐阅读
- java - Android Studio 调试不记录 Firestore 数据库读取
- ffprobe - ffprobe帧信息以解码或呈现顺序?
- r - 更好地绘制栅格砖/堆栈层的方法
- android - 我怎样才能只运行同一个应用程序的一个进程?
- vue.js - 将属性默认值注入 3rd 方 Vue 组件
- jenkins - 我们可以使用共享库在 jenkins 中将单个 jenkins 文件用于多分支 piepeline 吗?
- mdriven - Mdriven Designer 类属性 Allow Null=False 不起作用
- soap - 具有基本身份验证或 OAuth 的公共 SOAP Web 服务
- c# - 序列化增加大小
- python - 从 QDialog pyqt 打开 QMainwindow