Angular routing is not working with Cloudfront and S3

Discussão em 'Angular' iniciado por super7egazi, Outubro 18, 2024.

  1. super7egazi

    super7egazi Guest

    I have an angular 6 website hosted on S3 with S3 website hosting enabled. Also, I have a CloudFront distribution in front of it. I configured cloud front so that it redirects anything to index.html and responses with 200.

    However, only "/" can be accessed using CloudFront. Other urls such as "/*" are not loading. Angular loads "/" this instead. As if angular sees only "/".

    I added some code to log the url passed to angular and it turns out to be always "/".

    Also, some other times "/*" urls don't even load "/" and I see this error on console "Uncaught SyntaxError: Unexpected token <".

    Do you guys have any idea what could be causing this?

    S3 Settings [​IMG]

    Cloud front behavior:

    [​IMG]

    [​IMG]

    [​IMG]

    Continue reading...

Compartilhe esta Página