I've got a Spring boot application hosted on internal tomcat. We've enabled the below properties to force a redirect to HTTPS as a response.
server.use-forward-headers=true
server.tomcat.remote-ip-header=x-forwarded-for
server.tomcat.protocol-header=x-forwarded-proto
Now, I've a requirement to open this application for internal use as well and in this case, I should not force HTTPS in response.
I understand that I can use property
server.tomcat.internal-proxies=192\\.168\\.\\d{1,3}\\.\\d{1,3}
But I do not want to do this based on IP, rather want to use a specific value in the header.
Example: if header "X-Forwarded-Host" contains a value like "test.com.sg" --> then do NOT force HTTPS.
May I know how can I achieve this?