大网数据广告活动
网站运营与故障问答

302 redirect from WebSphere when the request has come via a load balancer

· 52CE 我爱测

I have the following setup: HTTPS request -> AWS ALB -> Mapped to HTTP (one of two possible ports) -> Websphere 9.0.5 This works fine, except: When I go to my url without a trailing slash (e.g. https://url.com/test instead of htt…

问题原文

原帖链接 · simonalexander2005 · CC BY-SA 4.0

I have the following setup:

HTTPS request -> AWS ALB -> Mapped to HTTP (one of two possible ports) -> Websphere 9.0.5

This works fine, except:

When I go to my url without a trailing slash (e.g. https://url.com/test instead of https://url.com/test/), WebSphere serves a 302 redirect to http://url.com:9082/test/, for example, instead of honouring the original https request and port. This then doesn't load because the internal http port is not accessible externally.

The original url and protocol is captured in X-Forwarded-Proto and X-Forwarded-Host headers.

Is there any way to tell WebSphere to do the redirect in the way I'd expect, so the user's browser sees https://url.com/test/? Or, alternatively, for the application to just work without the trailing slash?

已采纳解答

原帖链接 · simonalexander2005 · CC BY-SA 4.0

The following custom properties need to be configured in WebSphere, under Application Servers -> ServerName -> Web Container -> Custom Properties:

  • com.ibm.ws.webcontainer.extractHostHeaderPort=true
  • httpsIndicatorHeader=X-Forwarded-Proto
  • trusthostheaderport=true

See https://www.ibm.com/docs/en/was/9.0.5?topic=configuration-web-container-custom-properties for documentation

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2023-03-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。