How to prevent HTTP 404 during deployment of ear in Wildfly/Jboss

左心房为你撑大大i 提交于 2020-01-01 15:08:05

问题


We're using WildFly 10 as our application server and deploy via Docker (deployment in WF is ordinary hotdeployment). We're not using WildFly's clustering mechanisms but simply have load-balancers (HAProxys) in front.

The problem is that WF opens its HTTP port while the EAR deployment is still in progress. This (of course?) leads to HTTP 404 errors which we don't want to handle specifically in the LBs. This could lead to false negatives...

Is there a way to allow HTTP connections only after the EAR has started successfully?

Alternatively is it possible to replace the "404 because nothing is deployed here"-error with a "503 service unavailable"? This would much better express the problem and would be easy to handle externally...


回答1:


You can set default-response-code for host you are running this on.

something along the lines:

<host name="default-host" alias="localhost" default-response-code="503">

or in cli:

/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-response-code, value=503)

and similarly for any other host you might have.



来源:https://stackoverflow.com/questions/35534937/how-to-prevent-http-404-during-deployment-of-ear-in-wildfly-jboss

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