Configuration GZip at Wildfly

前端 未结 3 2151
温柔的废话
温柔的废话 2021-02-07 15:08

I\'m with a problem to configure the GZip in my Wildfly server used the following configuration on the server:



        
相关标签:
3条回答
  • 2021-02-07 15:49

    Expanding on Alexander's answer I did some tests. Strangely enough the predicate to only compress files larger then 500 bytes is not min-content-size[500].

    To configure it using jboss-cli.sh run this script:

    /subsystem=undertow/configuration=filter/gzip=gzipFilter:add()
    /subsystem=undertow/server=default-server/host=default-host/\
       filter-ref=gzipFilter:add(predicate="not min-content-size[500]")
    

    Note that the gzip filter will start to work after server reload. You can do this using cli's command :reload.

    To test if the filter is enabled I used:

    wget $MY_URL -S --header="accept-encoding: gzip" \
      -O /dev/null 2>&1| grep Content-Encoding
    
    0 讨论(0)
  • 2021-02-07 15:55

    It worked with the predicate:

    predicate="exists['%{o,Content-Type}'] and regex[pattern='(?:application/javascript|text/css|text/html|text/xml|application/json)(;.*)?', value=%{o,Content-Type}, full-match=true]"
    
    0 讨论(0)
  • 2021-02-07 16:07

    There is a predicate in undertow min-content-size so you can use predicate=min-content-size[500]

    I found the available predicates here https://github.com/undertow-io/undertow/tree/master/core/src/main/java/io/undertow/predicate due to lack of documentation

    0 讨论(0)
提交回复
热议问题