Babar Baig
Babar Baig

Reputation: 383

AWS Application Load Balancer not loading one of the target groups pointing to same EC2 instance

I have an EC2 instance which has two applications installed and configured

When I simply hit public DNS of EC2 instance following happens

I add an Application Load Balancer with 2 target groups and 2 listener rules. Both of the target groups are pointing to the same EC2 instance for accessing SonarQube and Jenkins

I have an AWS Route53 RecordSet which I am using to point to a domain. Here is the code for Route53 Record Set

   JenkinRecordSet:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      HostedZoneName: mydomain.com.
      RecordSets:
      - Name: "jenkins.mydomain.com"
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt myALB.Outputs.albHostedZone
          DNSName: !GetAtt myALB.Outputs.albDNS

   SonarRecordSet:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      HostedZoneName: mydomain.com.
      RecordSets:
      - Name: "sonar.mydomain.com"
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt myALB.Outputs.albHostedZone
          DNSName: !GetAtt myALB.Outputs.albDNS

Health checks are passed and I see both target groups register the same ec2 as healthy (one for sonar and other for jenkins on same ec2)

When I hit jenkins.mydomain.com/jenkins Jenkins is loaded perfectly fine and I can use it but when I hit sonar.mydomain.com/sonar Sonar is stuck at "Loading Screen". When I inspect the page I see that there are some JS files that Sonar is unable to find (404 error) and sonar freezes at loading.

This only happens when I put an application load balancer. When I access both Jenkins and Sonar via EC2 Public IP I can access both Jenkins and Sonar perfectly fine.

Sonar Loading Stuck

Can anyone help me resolve this issue with the Application Load Balancer? Is it suppose to be working like this?

Upvotes: 1

Views: 820

Answers (1)

Tuan Vo
Tuan Vo

Reputation: 2085

Sonar is client-side render, this is the root cause.

I suggest:

  1. pointing to sonar without path (root path)
  2. move build file to the right folder in public

Upvotes: 0

Related Questions