Skip to content

Instantly share code, notes, and snippets.

@mokua
Created July 24, 2018 13:12
Show Gist options
  • Save mokua/d890b8bf697d6e53d3f636267a79377a to your computer and use it in GitHub Desktop.
Save mokua/d890b8bf697d6e53d3f636267a79377a to your computer and use it in GitHub Desktop.
add gzip and cache static content for wildfly 11
<subsystem xmlns="urn:jboss:domain:undertow:4.0">
<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="server-header"/>
<filter-ref name="x-powered-by-header"/>
<filter-ref name="gzipFilter" predicate="regex[pattern='text/html|text/css|application/javascript|application/json|image/jpeg|application/octet-stream|image/png|application/font-woff2',value=%{o,Content-Type}] and max-content-size[value=1024]"/>
<filter-ref name="custom-max-age" predicate="path-suffix['.js'] or path-suffix ['.json'] or path-suffix ['.html'] or path-suffix ['.css'] or path-suffix ['.jpg'] or path-suffix ['.jpeg'] or path-suffix ['.png'] or path-suffix ['.gif'] or path-suffix ['.ico'] or path-suffix ['.woff2']"/>
<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/11"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
<response-header name="custom-max-age" header-name="Cache-Control" header-value="max-age=31536000, public"/>
<gzip name="gzipFilter"/>
</filters>
</subsystem>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment