如何在Wildfly / Jboss中部署耳朵时阻止HTTP 404 [英] How to prevent HTTP 404 during deployment of ear in Wildfly/Jboss

查看:503
本文介绍了如何在Wildfly / Jboss中部署耳朵时阻止HTTP 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用WildFly 10作为应用服务器,并通过Docker进行部署(在WF中部署是普通hotdeployment)。我们没有使用WildFly的集群机制,而是在前面安装了负载平衡器(HAProxys)。

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.

问题是WF打开HTTP端口,而EAR部署仍然存在进行中。这(当然是)导致HTTP 404错误,我们不想在LB中具体处理。这可能会导致假阴性...

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...

只有在EAR成功启动后才允许HTTP连接?

或者可以替换404因为没有部署在这里 - 错误与503服务不可用?这将更好地表达问题,并且可以很容易地在外部处理...

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...

推荐答案

您可以设置默认响应代码对于您正在运行的主持人。

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

沿线的一些东西:

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

或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.

这篇关于如何在Wildfly / Jboss中部署耳朵时阻止HTTP 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆