Spring 添加HTTPS支持会导致循环重定向
我在web应用程序中使用Spring安全框架。我已经安装了SSL证书,并且能够通过Spring 添加HTTPS支持会导致循环重定向,spring,tomcat,spring-mvc,spring-security,Spring,Tomcat,Spring Mvc,Spring Security,我在web应用程序中使用Spring安全框架。我已经安装了SSL证书,并且能够通过https访问我的应用程序。 现在,当我将requires channel=“https”属性添加到所有拦截url指令时,服务器响应: Error 310(net::ERR\u TOO\u MANY\u重定向)到多个连接 spring每次都运行此代码: 64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.FilterChainPro
https
访问我的应用程序。
现在,当我将requires channel=“https”
属性添加到所有拦截url
指令时,服务器响应:
Error 310(net::ERR\u TOO\u MANY\u重定向)到多个连接
spring每次都运行此代码:
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.FilterChainProxy - / at position 1 of 12 in additional filter chain; firing Filter: 'ChannelProcessingFilter'
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.util.AntPathRequestMatcher - Checking match of request : '/'; against '/'
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.access.channel.ChannelProcessingFilter - Request: FilterInvocation: URL: /; ConfigAttributes: [REQUIRES_SECURE_CHANNEL]
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint - Redirecting to: https://sky-handling.ejl-group.com/
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.DefaultRedirectStrategy - Redirecting to 'https://sub.domain.com/'
我怎样才能解决这个问题
多谢各位
UPD#1:
我将现有证书导入密钥库并配置了tomcat,但是如果我添加了这样的行:
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /usr/local/ssl/crt/public.crt
SSLCertificateKeyFile /usr/local/ssl/private/*.ejl-group.com.key
SSLCACertificateFile /usr/local/ssl/crt/intermediate.crt
ServerName sub.domain.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8443/
ProxyPassReverse / http://localhost:8443/
</VirtualHost>
斯伦金安
SSLCertificateFile/usr/local/ssl/crt/public.crt
SSLCertificateKeyFile/usr/local/ssl/private/*.ejl-group.com.key
SSLCACertificateFile/usr/local/ssl/crt/intermediate.crt
ServerName sub.domain.com
代理请求关闭
代理主机
命令拒绝,允许
通融
ProxyPass/http://localhost:8443/
ProxyPassReverse/http://localhost:8443/
由于
503服务暂时不可用
错误我认为这两行是关键:
ProxyPass / http://localhost:8443/
ProxyPassReverse / http://localhost:8443/
请注意,此处指定的是http,而不是https。因此,当客户端通过默认的HTTPS端口(443)访问您的网站时,httpd使用http方案将请求转发给tomcat实例。然后,tomcat尝试重定向到HTTPS/443端口,然后httpd使用http方案将请求转发给tomcat实例,以此类推
我不确定如果你简单地将sceme改为https是否会起作用,但是试试看
虽然我不知道您的安全要求,但通常在httpd前端和tomcat后端之间不需要SSL安全链接。考虑在这里使用简单的HTTP,或者甚至是AJP< P>我通过在SoCur.xml文件中添加端口映射来修复这个问题:
<http>
<port-mappings>
<port-mapping http="8088" https="8443"/>
<port-mapping http="80" https="443"/>
</port-mappings>
</http>
这个博客帮助我:
如果您使用的是负载平衡器,则必须添加一些代码:显示您的安全配置。
<http>
<port-mappings>
<port-mapping http="8088" https="8443"/>
<port-mapping http="80" https="443"/>
</port-mappings>
</http>