http - 当通过 https 发出原始请求时,在 Location-header 中获取 http

标签 http ssl redirect https undertow

我的问题:

1) 当来自浏览器的原始请求是使用 https 发出时,为什么我在 Location-header 中得到 http 作为方案?

2) 这是 wildfly 负载均衡器问题吗?

My Request Header is:

method: POST
scheme: https
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 39
content-type: application/x-www-form-urlencoded
origin: https://10.43.201.207
referer: https://10.43.201.207/myapp/login.html

My Response Header is:

content-length: 0
date: Thu, 03 Jan 2019 04:55:42 GMT
location: http://10.43.201.207/myapp/dashboard.html?init=1
server: WildFly/12
set-cookie: APP_AUTH=leTPWYd1222zsrrtRRtgpuEWEWc7pR0CBuNPYPT5QHbGn_Db7ICK; path=/; secure; HttpOnly
set-cookie: JSESSIONID="leTee33333PWYdSDSDweetRRtgpuc7pR0CBuNPYPT5QHbGn_Db7ICK.master-0:master-server"; Version=1; Path=/myapp; Secure; HttpOnly
status: 302
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-powered-by: Undertow/1
x-xss-protection: 1; mode=block

最佳答案

负载均衡器是否正在剥离 TLS 并将请求作为 HTTP 转发到应用程序?如果是这样,那么应用程序在执行重定向时,可能使用与接收请求相同的协议(protocol)。

如果是这种情况,要么让应用强制使用 https,要么让负载均衡器重写返回的响应。

您可能需要设置 proxy-address-forwarding="true" 和/或 request_header_add X-Forwarded-Proto https

关于http - 当通过 https 发出原始请求时,在 Location-header 中获取 http,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54016800/

相关文章:

Apache - 在没有安全警报的情况下将 https 重定向到不同的域

c# - 如何从重定向的网址下载文件?

http - 是否可以在同一个 HTTP session 中有多个用户

angularjs - for 循环中的递归 $http.get

具有自定义域名的 SaaS 应用程序的 SSL 设置

php - 如何在我的 paypal ipn 中使用 curl?

apache - 为什么 Apache 永久重定向会删除域和路径之间的斜线?

python - Django:使用 <select multiple> 和 POST

"AAAy H.mp3"的 HTTP 400 但不是 "AAAy L.mp3"

Java 客户端通过 SSL 使用 .NET WCF(不支持 WS-Policy)