简体   繁体   中英

JBoss AS 7: How to modify the server banner in http response header

I have a web app running in the following two setups: 1) JBoss running on Windows7 and 2) JBoss running with an apache httpd reverse proxy on CentOS.

I downloaded and added jbossWebService.jar to the WEB-INF/lib directory in order to use the org.jboss.web.tomcat.filters.ReplyHeaderFilter class. Following is my filter configuration.

<filter>

<filter-name>CommonHeadersFilter</filter-name>

<filter-class>

org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>

<init-param>

<param-name>X-Powered-By</param-name>

<param-value>MyWeb</param-value>

</init-param>

<init-param>

     <param-name>Server</param-name>

     <param-value>MyServer</param-value>

</init-param>

</filter>

In apache httpd conf file, I have the following, modifying which, did not have any effect as such.

ServerTokens ProductOnly 
ServerSignature Off

What I see in the browser:

The JBoss without apache httpd shows the following:

X-Powered-By: MyWeb, JSP/2.2

Server: Apache-Coyote/1.1, MyServer

The JBoss with apache as reverse proxy shows the following:

X-Powered-By: MyWeb, JSP/2.2

Server: Apache-Coyote/1.1

What I want:

The Apache-Coyote/1.1 and the JSP/2.2 to go away. The one behind apache httpd does not even show MyServer as the server banner. I would like that to show up, but that's not a necessity.

Any help is appreciated.

Thanks.

Prajesh

Setting the system property org.apache.coyote.http11.Http11Protocol.SERVER seems to work in JBoss AS 7.1.1.Final

<system-properties>
<property name="org.apache.coyote.http11.Http11Protocol.SERVER" value="secretserver"/>
</system-properties>

Although be warned the system property mentioned above ('org.apache.coyote.http11.Http11Protocol.SERVER') is not present in the sys properties documentation for the latest version of JBoss Web, so if setting that property is not working then maybe it is missing from the version of JBoss Web you are using and writing a custom filter maybe the only option :(

http://docs.jboss.org/jbossweb/latest/sysprops.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM