AWS Amplify Redirects not working correctly

Discussão em 'Angular' iniciado por Daniel Weiß, Junho 19, 2025.

  1. Daniel Weiß

    Daniel Weiß Guest

    I have an Angular application with normal Angular internationalization (English & German). This means that my frontend is built once in English and once in German.

    It is located in the following folders:

    /dist/my-app/browser <-- English
    /dist/my-app/browser/de <-- German


    When I visited my Amplify app, I was always redirected to the root domain: www.my-app.com/de/ -> www.my-app.com

    Now I have found out that it is due to the redirects in Amplify, and I have also tried to configure them. But that doesn't really work.

    Here is my redirects JSON from Amplify:

    [
    {
    "source": "https://my-app.com",
    "status": "302",
    "target": "https://www.my-app.com"
    },
    {
    "source": "/de/<*>",
    "status": "404-200",
    "target": "/de/index.html"
    },
    {
    "source": "/de</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>",
    "status": "200",
    "target": "/de/index.html"
    },
    {
    "source": "/<*>",
    "status": "404-200",
    "target": "/index.html"
    },
    {
    "source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>",
    "status": "200",
    "target": "/index.html"
    }
    ]


    Currently, when I go to www.my-app.com/de/, I get the correct .html file back, but unfortunately I also get index.html back when I want to load JavaScript files. www.my-app.com/de/main.js returns www.my-app.com/de/index.html.

    I just took the existing entries and adjusted them with /de/.

    Continue reading...

Compartilhe esta Página