0
votes

We have a HAProxy in front of a tomcat cluster in our environment. Right now, we are directing all the traffic on ports 80 and 443 to the tomcat-https backend. The issue is that some of our subdomain names need to be processed before it hits the https, with the current setup we are running into the insecure certificate issue. So, now we need to direct these subdomains to 8080 on tomcat. These subdomains are not fixed names, we need to just check if there is a subdomain and direct it to 8080 or else to 443.

1
How does it "hit the https?" Are you using mode tcp with HTTPS on the server (instead of on HAProxy)? - Michael - sqlbot
it's mode http with HTTPS on the server. - Mahesh H Viraktamath
So the first SSL certificate is installed on HAProxy itself, then? - Michael - sqlbot
Yes. HAProxy receives these HTTPS connections on 443, but it also receives HTTP on 80. And then it redirects them all to 443 on the application server. Now, we want to redirect HTTP to 8080 on application server if there is a subdomain in the URL - Mahesh H Viraktamath

1 Answers

1
votes

You can use acl to check for the presence of a subdomain name in the URL. It can be done like this.

acl subdomain_not_present hdr_beg(host) -i www

And then depending on the value of subdomain_not_present, you can use the appropriate backend to redirect to.