I am trying to reproduce and solve an issue of my customer. The intention was to reuse a single ALB for multiple URLs, which is hosted on a single HTTPD server listening two different ports. What I've done is to create two different Target Group, one for port 80 and one for port 81. Then I linked the two TG to a single ALB. Also, I have -- like my customer also did -- create a rule in ALB listener, so that any request with HTTP header HOST a.customerdomain.com be forwarded to TG1 on port 80, which any request withHTTP header HOST b.customerdomain.com be forwarded to TG2 on port 81. However, after my this setting, the request to a.customerdomain.com seems to work fine, while request b.customerdomain.com get 502 Bad Gateway .
Here is the other facts that might be related
- Both DNS records has been set.
- ALB security group open 443 to the internet
- Both certs been issued in ACM and attached to the ALB
- Security group of the instance allows traffic 80-81 from the whole VPC.
By the way, the virtual host settings are as follows.
Both confirmed OK.
I tried the settings with my AWS account, and I was able to confirm that I could access both without any problems.
By the way, what are your virtual host settings?