您的位置:首页 > 运维架构 > Tomcat

Tomcat 禁用PUT方法, 404/500错误重定向, 网站图标

2013-08-24 11:41 555 查看
(1) Tomcat禁用Put等不安全方法。

<security-constraint>
<web-resource-collection>
<web-resource-name>xxxx-Security-Constraint-0</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint>
</auth-constraint>
</security-constraint>


参考文档: http://yingfangming.blog.163.com/blog/static/165802470201291622853362/

(2) 常见错误页面定向

<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>


如果只是这样配置IE浏览器不会重定向,error.jsp里面要写上下面代码,把response的header status code置为200.

<%
response.setStatus(200);
%>


参考文档: http://origin100.iteye.com/blog/383460 也可以设置按照异常定向。

(3)网站图标

更换ico图标文件。

参考: http://yaojialing.iteye.com/blog/526339
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐