![]() Version: 9.4.12.v20180830 |
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development
org.eclipse.jetty.servlets.HeaderFilter
The header filter sets or adds headers to each response based on an optionally included/excluded list of path specs, mime types, and/or HTTP methods.
This filter processes its configured headers before calling doFilter
in the filter chain. Some of the headers configured in this filter may get overwritten by other filters and/or the servlet processing the request.
To use the Header Filter, these JAR files must be available in WEB-INF/lib:
Place the configuration in a webapp’s web.xml
or jetty-web.xml
.
This filter will perform the following actions on each response:
Note
Each action must be separated by a comma.
<filter>
<filter-name>HeaderFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.HeaderFilter</filter-class>
<init-param>
<param-name>headerConfig</param-name>
<param-value>
set X-Frame-Options: DENY,
"add Cache-Control: no-cache, no-store, must-revalidate",
setDate Expires: 31540000000,
addDate Date: 0
</param-value>
</init-param>
</filter>
The following init
parameters control the behavior of the filter:
action headerName: headerValue
.Supported header actions:
set
- causes set setHeader
to be called on the responseadd
- causes set addHeader
to be called on the responsesetDate
- causes setDateHeader
to be called on the response.addDate
- causes addDateHeader
to be called on the response.If setDate
or addDate
is used, headerValue
should be the number of milliseconds to add to the current system time before writing the header value.
If a property is both included and excluded by the filter configuration, then it will be considered excluded.
Path spec rules:
^
, the spec is assumed to be a regex based path spec and will match with normal Java regex rules./
, the spec is assumed to be a Servlet url-pattern rules path spec for either an exact match or prefix based match.*.
, the spec is assumed to be a Servlet url-pattern rules path spec for a suffix based match.