Hosting multiple domains with WildFly (Undertow)

匿名 (未验证) 提交于 2019-12-03 08:46:08

问题:

For example I have two domains (app1.com, app2.com) and two ears (app1.ear, app2.ear). Each EAR file consists of ejb.jar and web.war. Also each WAR has context root: /app1 or /app2.

So if I start WildFly I will have two applications running on localhost:8080/app1 and localhost:8080/app2.

How I can bind app1.com to localhost:8080/app1 and app2.com to localhost:8080/app2?

As I understand, I should modify Undertow subsystem configuration in standalone.xml. I tried:

<server name="default-server">     <http-listener name="default" socket-binding="http"/>     <host name="app1.com" default-web-module="app1.ear/web.war"/>     <host name="app2.com" default-web-module="app2.ear/web.war"/> </server>

but it's doesn't work.

回答1:

Add WEB-INF/jboss-web.xml

with contents

<jboss-web>   <context-root>app1</context-root>   <virtual-host>app1.com</virtual-host> </jboss-web>

and similarly for second war.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!