Search code examples
amazon-web-servicesaws-application-load-balancer

AWS ALB: Listener rules do not find static resources


I created a application load balancer and a HTTPS listener. Now I want to add a path rule into the HTTPS listener rules. When I add the following path (rule priority 1):
/Staging_app*
and when I call
[Load Balancer URL]/Staging_app/index.html
it returns the index page but I get for every static resource (like javascript files, css files, pictures) a 404 response.

When I try to get the resources via:
[ECS Fargate Task dynamic IP]/resource.css
I get the resources.

When I try to add the following rule entry:
Path is /Staging_app* OR /Staging_app/* OR /Staging_app
I have the same problem.

The rule forwards to the ECS fargate service target group.


Solution

  • I can not use the listener rules to manage all my apps with one ALB (not the way I wanted to do that).
    When I configure a listener rule like this:
    /Staging_app*

    And when I call:
    [Load Balancer URL]/Staging_app/index.html

    I thought I get this files/resources:
    /index.html
    /resource.css

    But the request will not edited by AWS and AWS searches for:
    Staging_app/resource.css

    But this path does not exist.
    This question helped me to understand my mistake: How to tell AWS application load balancer to not forward the path pattern?