Hide HTTP header information in a JSF Application

Source: Internet
Author: User

 

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 ">?
  1. <Context-param>
  2. <Param-Name>Com. Sun. Faces. sendpoweredbyheader</Param-Name>
  3. <Param-value>False</Param-value>
  4. </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 ">?
  1. <Filter>
  2. <Filter-Name>Commonheadersfilter</Filter-Name>
  3. <Filter-class>Org. JBoss. Web. tomcat. Filters. replyheaderfilter</Filter-class>
  4. <Init-param>
  5. <Param-Name>X-powered-</Param-Name>
  6. <Param-value>Servlet 2.4; JBoss-4.2.0.GA (Build:
  7. Svntag = jbpapp_4_2_0_ga date = 200706281411)/tomcat-5.5</Param-value>
  8. </Init-param>
  9. </Filter>
  10. Bytes
  11. <Filter>
  12. <Filter-Name>Commonheadersfilter</Filter-Name>
  13. <Filter-class>Org. JBoss. Web. tomcat. Filters. replyheaderfilter</Filter-class>
  14. </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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.