reactjsmonorepomicro-frontendwebpack-module-federation

CORS issue in micro frontend repo


Context: I'm working in a monorepo, I've setup architecture using NX. I've been trying to build micro frontend apps and I've managed to do so using module federation on local environment. For that purpose I've to start both of my apps locally. So host app runs at http://localhost:4200/ which can load my remote app which is running on http://localhost:4201/

Question Now I wants to load my remote app where it is hosted (it's hosted on S3 bucket as a static web) instead of my localhost, but I'm getting CORS issue even though I've defined rule for that on my S3 bucket to allow cross origin.

Any help would be much appreciated.

Attaching screenshot of my error below: Error Screenshot

I've defined CORS policy as below snippet:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "HEAD"
        ],
        "AllowedOrigins": [
            "http://localhost:4200/"
        ],
        "ExposeHeaders": []
    }
]

Solution

  • After spending lot of time It turned out that my path to the remoteEntry.js wasn't correct. Thanks