0

I have an application load balancer (ALB) in AWS for an Angular 6 application. I am experiencing issues when I attempt to access the application through the ALB. I have other applications I can access through the same ALB so I know security groups, and other networking configurations are properly configured.

I have a listener on the ALB at port 80, and I am using path routing to serve multiple applications through port 80 on the ALB. The path I have the Angular app at is /angular*.

When I attempt to access the Angular application I receive a 503 error for some application assets, and 200 for others. Specifically, I receive the index.html fine, but none of the JS files come back, and I get a 503 for each of them.

I thought this might be an issue with the "base_href" in my index.html file so I changed that to match the path I have set on the ALB for the application. However, I am still receiving the same error. Any suggestions on the possible issue would be much appreciated.

Jackson
  • 6,391
  • 6
  • 32
  • 43
  • 503 errors on AWS are purely server side problems. It might not even be related to the load balancer, but a misconfigured load balancer can yield a 503 when you reach capacity, have no instances or have unhealthy instances. I would assume it was the later. – Reactgular Dec 14 '18 at 19:48
  • I agree, I think the issue is with the use of path routing, and what is being sent in the request to the Angular application. I'm hoping someone has run into this problem specifically with Angular. – Jackson Dec 14 '18 at 19:55
  • Maybe I misunderstood. Are you referring to Angular routing or AWS? – Reactgular Dec 14 '18 at 20:01
  • I think the problem is a combination. l am using the path routing option on the ALB, which I think I need to account for in the Angular application. I am able to get the index.html page back when I attempt to access the application but not any of the JS files. – Jackson Dec 14 '18 at 20:08
  • When you receive 503 errors some assets. Do you always get 503 errors for those assets or do they sometimes load with a 200? – Reactgular Dec 14 '18 at 20:33
  • I always get a 503, for all assets except the index.html file. So runtime.js, etc. – Jackson Dec 14 '18 at 20:49

1 Answers1

0

I encountered the same problem and got them resolved. When the path route was specified, I placed the whole source of the files in a sub-directory (with the same name as path u specified) inside the root directory and also like you've mentioned changed the base-href in the index to be like "/path-name/". Now I get my website loaded.

I now face another problem where the routes inside the angular application seems to be not working (shows 404,403) which need to solved by adding redirect to index.html for 403 and 404 error codes.