首页 > 解决方案 > 所有静态内容请求都转到 Jboss EAP 7.1 ,而不是在 Webserver 中查找

问题描述

最近,我从 Jboss EAP 6.4 迁移到了 Jboss EAP 7.1。我在 Jboss EAP 前面有一个 Jboss EWS,通过 mod 集群连接到它们。我使用一些保存在 websever (Jboss EWS) 中的静态内容。在访问网络服务器 URL 时,它用于为网络服务器中的静态内容提供服务。

但是,在迁移到 JBoss EAP 7.1 之后,它正在 Appserver 中寻找静态内容并给出 404。这可能是由于新添加了 undertow,而这在 Jboss EAP 6.x 中没有到位 我应该做什么更改(可能在 undertow config 中),以便它在 webserver 本身而不是 appservers 中查找静态内容。

标签: apachehttp-status-code-404undertowjboss-eap-7mod-cluster

解决方案


您需要将文件处理程序和另一个位置添加到 Standalone.xml 中的 undertow 子系统以提供静态内容(如图像):

<server name="default-server">
    <http-listener name="default" socket-binding="http"/>
    <host name="default-host" alias="localhost">
        <location name="/" handler="welcome-content"/>
        <location name="/img" handler="images"/>
    </host>
</server>
<handlers>
    <file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>
    <file name="images" path="/var/images" directory-listing="true"/>
</handlers>

推荐阅读