0

WebSphere Liberty and Open Liberty, all version.

I want remove "Content-Language" header from Servlet/JSP response, because of browser translation function accidentally popup. It seems that Liberty adds this header on all response in default, and there is no setting option to prevent this behavior. I've tried response.setLocale(Locale.ROOT); and servlet filter that ignore setHeader/addHeader of Content-language. But I couldn't eliminate the header.

Does anyone have an idea?

Takakiyo
  • 3
  • 1

2 Answers2

0

There is no direct way to stop or remove the response "Content-Language" header. However, if you set response header "Content-Language" before the response is committed, the server won't change it and retain your setting.

Thanks,

pmdinh
  • 146
  • 1
0

As of Open Liberty 21.0.0.12 you can use the "Configurable Response Headers" support to remove any header you want. See the following blog post for additional details on how to use the feature: https://openliberty.io/blog/2021/11/26/jakarta-ee-9.1.html.

For instance you can do the following in your server.xml:

<httpEndpoint id="defaultHttpEndpoint"
              httpPort="9080"
              httpsPort="9443">

    <headers>
        <remove>Content-Language</remove>
    </headers>
</httpEndpoint>