Wildfly 13 gzip 过滤器属性

Wildfly 13 gzip filter properties

之前我使用的是 Jboss 7.1,我在其中为 gzip 过滤器配置了以下属性,以提高我的产品性能。它工作正常。

<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION" value="force"/>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" value="text/javascript,text/css,text/html"/>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIN_SIZE" value="1000"/>

现在,我最近迁移到了 Wildfly 13,我认为这个属性在其中不起作用。那么,你能帮我解决这个问题吗?

另外,请问还有什么重要的配置可以提升wildfly的性能吗?

WildFly 13 使用 Undertow 作为其 Web 容器而不是 JbossWeb/Apache Tomcat,因此属于 Tomcat 的过滤器不可用。 请看一下

我做了研究并找到了解决方案。请在 standalone.xml 中搜索 undertow 并添加过滤器相关的配置更改,如下所述:

<subsystem xmlns="urn:jboss:domain:undertow:6.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
    <buffer-cache name="default"/>
    <server name="default-server">
        <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
        <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
        <host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
            <filter-ref name="gzipFilter" predicate="not min-content-size[500] and regex[pattern='(?:application/javascript|text/css|text/html|text/xml|application/json)(;.*)?', value=%{o,Content-Type}, full-match=true]"/>
            <filter-ref name="server-header"/>
            <http-invoker security-realm="ApplicationRealm"/>
        </host>
    </server>
    <servlet-container name="default">
        <jsp-config/>
        <websockets/>
    </servlet-container>
    <handlers>
        <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
    </handlers>
    <filters>
        <response-header name="server-header" header-name="Server" header-value="Wildfly 13"/>
        <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow"/>
        <gzip name="gzipFilter"/>
    </filters>
</subsystem>