2

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?

2
  • What configuration do you have in Websphere to implement this redirect? Commented Mar 27, 2023 at 15:33
  • I've not implemented anything specific - it appears to be a default configuration Commented Mar 28, 2023 at 8:05

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.