我的问题:
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/