I have multiple instances of springboot application running in Websphere Libery, with following server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<server description="my_app">
<!-- Enable features -->
<featureManager>
<feature>springBoot-2.0</feature>
<feature>servlet-4.0</feature>
<feature>transportSecurity-1.0</feature>
</featureManager>
<springBootApplication location="my_app.war">
<applicationArgument>--spring.config.location=file:../relative/path/to/config/</applicationArgument>
<applicationArgument>--server.liberty.use-default-host=false</applicationArgument>
</springBootApplication>
<httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="-1" httpsPort="-1"/>
</server>
Each instance internally chooses the HTTPS port number (springboot application is configured to only accept SSL connections, but that's not the point). I know WLP creates a virtualHost for the spring boot application, based on the server port. In console log, I can see something like this:
[AUDIT ] CWWKT0016I: Web application available (springBootVirtualHost-8443): https://wlp-host:8443/spring-app-ctx-root/
If I access directly that HTTPS url, it works as expected.
However, these multiple instances of the application are being accessed via a load-balancer (also via HTTPS), that injects HTTP header "Host: load-balancer-host-name" when redirecting the requests to a chosen instance (on a given port).
Assuming If I add the following to server XML of one of the instances while the application is running...
<virtualHost id="springBootVirtualHost-8443">
<hostAlias>load-balancer-host-name:443</hostAlias>
</virtualHost>
... WLP is able to recognise this configuration and correctly respond to HTTPS requests that come with HTTP header "Host: load-balancer-host-name"
However, when I reboot the WLP instance already with this "virtualHost" configuration, not only HTTP header "Host: load-balancer-host-name" is not recognised anymore, but also WLP seems to fail to bootstrap springBootVirtualHost-8443, meaning that direct requests to "https://wlp-host:8443/spring-app-ctx-root" also don't work anymore (and corresponding [AUDIT] log for springBootVirtualHost-8443 is not displayed).
It looks like, when WLP reads the virtualHost configuration for springBootVirtualHost-8443, it somehow does it before the springboot app is launched and overtakes its configuration. SpringBoot app then fails to create this "springBootVirtualHost-8443" virtualHost, because it's already taken.
Any ideas?