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

问题描述 投票:0回答:2

我的问题:

1)当使用https进行浏览器的原始请求时,为什么我在Location-header中获取http作为方案?

2)这是一个野生蝇负载平衡器问题吗?

我的请求标题是:

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

我的回复标题是:

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
http ssl redirect https undertow
2个回答
1
投票

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

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

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


0
投票

以下是针对上述问题的详细解决方案说明:

我们有一个负载平衡器坐在两个wildfly服务器前面。负载均衡器处理SSL握手并强制通过https的所有流量,wildfly节点上没有证书,负载均衡器和服务器之间的流量未加密,wildfly节点对SSL一无所知。负载均衡器和wildfly之间的通信节点是通过http协议。

当用户点击受保护的页面时,例如https://someip/app

请求流程如下:

  • 客户端浏览器通过https加载平衡器
  • 通过http协议将负载均衡器加载到wildfly节点。
  • 在wildfly服务器节点qazxsw poi listener中添加了qazxsw poi

0
投票

另一个选择是让负载均衡器将Strict-Transport-Security标头添加到服务器响应中,例如:

proxy-address-forwarding="true"

这将有效地告诉客户他应该始终使用https来联系您的服务器。

© www.soinside.com 2019 - 2024. All rights reserved.