For JSF applications, you may see the following in the HTTP header information:
Server: Apache/2.0.61 (UNIX)
X-powered-by: JSF/1.2.
It is meaningless to let users know these messages and may cause security vulnerabilities. To disable this feature, follow these steps:
Hide Server Information: In Apache, add a line in httpd. conf.
ServerTokens Prod
Hide X-powered-: Add the following content to Web. xml:
{
Function onclick ()
{
DP. Sh. toolbar. Command ('viewsource', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 "> View plain {
Function onclick ()
{
DP. Sh. toolbar. Command ('copytoclipboard', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 "> copy to clipboard {
Function onclick ()
{
DP. Sh. toolbar. Command ('printsource', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 "> Print {
Function onclick ()
{
DP. Sh. toolbar. Command ('about', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 ">?
- <Context-param>
- <Param-Name>Com. Sun. Faces. sendpoweredbyheader</Param-Name>
- <Param-value>False</Param-value>
- </Context-param>
<Context-param> <br/> <param-Name> COM. sun. faces. sendpoweredbyheader </param-Name> <br/> <param-value> false </param-value> <br/> </context-param>
For JBoss, you need to find this file: <jboss_home>/Server/default/deploy/jboss-web.deployer/CONF/Web. XML, and then add the following code:
{
Function onclick ()
{
DP. Sh. toolbar. Command ('viewsource', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 "> View plain {
Function onclick ()
{
DP. Sh. toolbar. Command ('copytoclipboard', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 "> copy to clipboard {
Function onclick ()
{
DP. Sh. toolbar. Command ('printsource', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 "> Print {
Function onclick ()
{
DP. Sh. toolbar. Command ('about', this); Return false;
}
} "Href =" http://www.ondev.net/post/show/585 ">?
- <Filter>
- <Filter-Name>Commonheadersfilter</Filter-Name>
- <Filter-class>Org. JBoss. Web. tomcat. Filters. replyheaderfilter</Filter-class>
- <Init-param>
- <Param-Name>X-powered-</Param-Name>
- <Param-value>Servlet 2.4; JBoss-4.2.0.GA (Build:
- Svntag = jbpapp_4_2_0_ga date = 200706281411)/tomcat-5.5</Param-value>
- </Init-param>
- </Filter>
- Bytes
- <Filter>
- <Filter-Name>Commonheadersfilter</Filter-Name>
- <Filter-class>Org. JBoss. Web. tomcat. Filters. replyheaderfilter</Filter-class>
- </Filter>
<Filter> <br/> <filter-Name> commonheadersfilter </filter-Name> <br/> <filter-class> Org. JBoss. web. tomcat. filters. replyheaderfilter </filter-class> <br/> <init-param> <br/> <param-Name> X-powered-by </param-Name> <br/> <param-value> servlet 2.4; JBoss-4.2.0.GA (Build: <br/> svntag = jbpapp_4_2_0_ga date = 200706281411) /tomcat-5.5 </param-value> <br/> </init-param> <br/> </filter> <br/> restart <br/> <filter> <br/> <filter-Name> commonheadersfilter </filter-Name> <br/> <filter-class> Org. JBoss. web. tomcat. filters. replyheaderfilter </filter-class> <br/> </filter> <br/>
Reprinted from http://www.ondev.net/post/show/585