相关疑难解决方法(0)

如何处理 Spring Boot 2.2.0 中的 x-forwarded-headers?(反向代理背后的Spring Web MVC)

我的带有 Spring Web MVC 的 Spring Boot 2.2.0 应用程序在反向代理后面运行。Spring 如何正确处理X-Forwarded-{Prefix,Host,Proto}-headers 以识别向服务器发出的实际请求?

spring-mvc spring-boot

19
推荐指数
1
解决办法
2万
查看次数

在Apache Tomcat中执行301重定向从http到https

我在我的Web应用程序中配置了SSL.我已根据所需步骤在我的Tomcat中安装了证书.

我一直关注的教程是 https://www.mulesoft.com/tcat/tomcat-security

我强制使用https over http,这意味着任何对http的请求都将转发到https.我在server.xml中进行了以下更改

<Connector port="8080" protocol="HTTP/1.1" 

           connectionTimeout="20000" 

           redirectPort="443"

           proxyHost="10.1.1.1" proxyPort="80"

           URIEncoding="UTF-8"

           maxHttpHeaderSize="32768"/>
Run Code Online (Sandbox Code Playgroud)

web.xml更改如下:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>SecureConnection</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)

但是,正在发生的重定向是临时重定向,即302.我想使用301重定向,即永久重定向.

我怎样才能做到这一点?

apache ssl tomcat

11
推荐指数
1
解决办法
2586
查看次数

CloudFoundry上的HTTPS Spring安全性

我尝试使用spring security xml中的以下配置在CloudFoundry上访问我的应用程序

<intercept-url pattern="/signup*" access="permitAll" requires-channel="https" />
Run Code Online (Sandbox Code Playgroud)

但它给了我错误这个网页有一个重定向循环

但是当我改变它时,requires-channel="http"我可以正常看到我的页面.在我用于https我的应用程序的两种情况下.这是预期的行为吗?

spring-mvc spring-security cloud-foundry

3
推荐指数
1
解决办法
1556
查看次数