【问题标题】:Replace images with static content wildfly 10用静态内容替换图像 wildfly 10
【发布时间】:2017-06-13 08:08:31
【问题描述】:

在我们的应用中,JBoss 7.2 上的静态内容使用重写规则进行部署:

<rewrite name="rule-1" pattern="^(\/my_app\/(?!(exclude)\/)((.*)\.(css|gif|ico|jpg|PNG|png)))$" substitution="/another.war/my_app/$3" flags="L"/>

而且效果很好

现在,我想在 wildfly 10 上部署静态内容,但我不能。 undertow 子系统是:

<subsystem xmlns="urn:jboss:domain:undertow:3.0">
                <buffer-cache name="default"/>
                <server name="default-server">
                    <http-listener name="default" socket-binding="http"/>
                    <host name="default-host" alias="localhost">
                        <location name="/" handler="welcome-content"/>
                        <location name="/my_app" handler="static"/>
                        <filter-ref name="server-header"/>  
                        <filter-ref name="x-powered-by-header"/>
                    </host>
                </server>
                <servlet-container name="default">
                    <jsp-config/>
                    <websockets/>
                </servlet-container>
                <handlers>
                    <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
                    <file name="static" path="${jboss.home.dir}/welcome-content/my_app" directory-listing="true"/>
                </handlers>
                <filters>
                    <response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
                    <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
                </filters>
            </subsystem>

预期结果是希望在浏览器中显示的图像被路径上的图像替换,而不是图像的 404 未找到。

谢谢

【问题讨论】:

    标签: wildfly undertow static-content


    【解决方案1】:

    你必须在你的虚拟主机中使用 Undertow 谓词 http://undertow.io/undertow-docs/undertow-docs-1.2.0/index.html#predicates-attributes-and-handlers 并带有这样的重写标签:

    【讨论】:

    • 你写了“像这样”,什么都没有:(
    猜你喜欢
    • 2014-05-06
    • 2013-12-02
    • 2018-09-28
    • 2017-02-19
    • 1970-01-01
    • 2018-01-29
    • 1970-01-01
    • 2015-11-09
    • 2014-04-03
    相关资源
    最近更新 更多