How to set Server X-Content-Type-Options in IBM WebSphere Application Server?

691 Views Asked by At

I have a IBM WebSphere Application Server 8.5 and want to set a X-Content-Type-Options nosniff. Thanks a lot!

1

There are 1 best solutions below

0
On

In your application (including possibly in a servlet filter) you can use HTTPServletResponse.setHeader() to add any header you desire.

https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#setHeader(java.lang.String,%20java.lang.String)

If you run your application on WebSphere Liberty, you can additionally add/modify headers via the configuration file: https://openliberty.io/blog/2021/10/05/configurable-response-headers-21.0.0.11-beta.html

If you have a HTTP proxy server in front of WebSphere, you can usually manipulate headers via the configuration file.