升级Hawtio 4后无法修改ActiveMQ Artemis控制台URL路径
ActiveMQ Artemis 2.41.0(Hawtio 4)自定义控制台根路径配置方案
问题背景
升级到集成Hawtio 4的ActiveMQ Artemis 2.41.0版本前,通过修改bootstrap.xml可将控制台映射到非/console的路径(如http://my-domain.com/artemis/console)。但按更新日志移除plugin和branding配置后,访问该路径仅显示白屏,浏览器控制台报404错误:
GET https://my-domain.com/console/static/js/main.8fa1b556.js net::ERR_ABORTED 404 (Not Found) GET https://my-domain.com/console/static/css/main.c469f802.css net::ERR_ABORTED 404 (Not Found) GET https://my-domain.com/console/remoteEntry.js net::ERR_ABORTED 404 (Not Found)
可见Hawtio 4前端资源引用路径默认硬编码为/console,未适配自定义URL前缀。
解决步骤
1. 添加JVM启动参数
在Artemis启动时指定控制台上下文路径的系统属性,覆盖默认的/console:
-Dhawtio.path=/artemis/console
该参数会同步更新Hawtio 4前端和后端的资源路径基准。
2. 调整bootstrap.xml配置
修改<web>和<app>节点,确保路径配置与JVM参数一致:
<broker xmlns="http://activemq.apache.org/schema"> <jaas-security domain="activemq"/> <server configuration="file:/config/broker.xml"/> <web path="web" rootRedirectLocation="artemis/console"> <binding name="artemis" uri="http://0.0.0.0:8161"> <app name="console" url="artemis/console" war="console.war"/> </binding> <binding uri="http://0.0.0.0:8162"> <app url="metrics" war="metrics.war"/> </binding> </web> </broker>
rootRedirectLocation需改为自定义路径artemis/console,确保根路径访问时能正确跳转至控制台<app>的url属性保持与自定义路径一致
3. 重启服务
应用配置后重启ActiveMQ Artemis,使JVM参数和XML配置生效。
验证方法
访问http://my-domain.com/artemis/console,检查:
- 页面正常加载显示控制台界面
- 浏览器控制台无404错误
- 资源请求路径已变为
https://my-domain.com/artemis/console/static/js/...格式
内容的提问来源于stack exchange,提问作者Stevenpc3
相关产品推荐
相关产品推荐

