Java 使用HTTPS保护Netbeans 6.7 tomcat管理器URL
这适用于Netbeans 6.7中的Tomcat 6.0.18 我已经在tomcat中实现了自签名SSL。但是,当我输入tomcat管理器url时,例如Java 使用HTTPS保护Netbeans 6.7 tomcat管理器URL,java,tomcat,ssl,netbeans,Java,Tomcat,Ssl,Netbeans,这适用于Netbeans 6.7中的Tomcat 6.0.18 我已经在tomcat中实现了自签名SSL。但是,当我输入tomcat管理器url时,例如http://localhost:8080/manager/html它没有重定向到https://localhost:8443/manager/html 我已经从Netbeans的位置C:\Documents and Settings\user\.Netbeans\6.7\apache-Tomcat-6.0.18_base\conf对Tomcat
http://localhost:8080/manager/html
它没有重定向到https://localhost:8443/manager/html
我已经从Netbeans的位置C:\Documents and Settings\user\.Netbeans\6.7\apache-Tomcat-6.0.18_base\conf对Tomcat的server.xml进行了更改
<Connector
port="8443"
protocol="HTTP/1.1"
SSLEnabled="true"
keystoreFile="c:/ssl/keystore"
keystorePass="myPassword"
maxThreads="150"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS" />
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
在web.xml中,我在C:\Documents and Settings\user\.netbeans\6.7\apache-tomcat-6.0.18\u base\conf中添加了以下内容
<Connector
port="8443"
protocol="HTTP/1.1"
SSLEnabled="true"
keystoreFile="c:/ssl/keystore"
keystorePass="myPassword"
maxThreads="150"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS" />
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
整个应用程序
/*
保密的
我遗漏了什么吗?您必须编辑两个文件- 打开通常在tomcat/conf中找到的server.xml并更改:
Connector port="8080"
enableLookups="false"
redirectPort="8443"
到
连接器端口=“8080”
enableLookups=“false”
重定向端口=“443”
其次,在web.xml中添加此代码段
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
受保护上下文
/*
保密的
就这些。重新启动服务器。从现在起,所有页面都将重定向到https。除了更新server.xml和web.xml以获取tomcat SSl自签名证书外,我还更新了tomcat manager webapp的web.xml中的安全约束,如下所示
<security-constraint>
........
........
........
........
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
........
........
........
........
保密的
当我输入http://localhost:8080/manager/html
它总是重定向到https端口
谢谢
Wap Rau非常感谢拉马纳森的回答。我会检查的。希望这能奏效。如果有任何问题,我会让你知道。很抱歉迟回复@Keerthi Ramanathan。我不能做太多,因为我需要测试的机器是我无权访问的客户机。我一有权限就用你的解决方案进行了测试。虽然您的解决方案确实有所帮助,但它没有按预期工作。然而,我找到了解决问题的方法,并将其作为答案发布。