How do I get my Angular app deployed to S3 respond to routing URLs

Discussão em 'Angular' iniciado por Vihung, Fevereiro 7, 2025.

  1. Vihung

    Vihung Guest

    I have Angular app that uses routing, built and deployed to an S3 bucket. It works fine if I go to the root of URL of the app. e.g. www.my-app.com.s3.foo.bar.amazonaws.com/

    And it works fine within the app. For example if I follow a router link that points to ['/home'] it goes to www.my-app.com.s3.foo.bar.amazonaws.com/home and so on.

    But if I go directly to, say, www.my-app.com.s3.foo.bar.amazonaws.com/home, I get an S3 error saying the resource does not exist. This is true - there is no file in the S3 bucket corresponding to /home.

    How do I ensure that URL requests get routed through the app rather than to S3?

    Update: It looks like CloudFront might do this. What do I configure in CloudFront?

    Continue reading...

Compartilhe esta Página