Score:1

How to add security related headers in tomcat 9

au flag

I want to add several security related HTTP response headers with tomcat(version 9). I have enabled following config in web.xml

<filter>
    <filter-name>httpHeaderSecurity</filter-name>
    <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
    <async-supported>true</async-supported>
</filter>
<filter-mapping>
    <filter-name>httpHeaderSecurity</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Now I get following headers in http response. enter image description here

Furthermore I would like to have following headers also.

  • referrer-policy
  • x-permitted-cross-domain-policies
  • permission-policy (or feature-policy)

How can I add these header to the http response?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.