So basically there is a host app which is gets remote microfrontend files from another firebase url.
So remote app is hosted on firebase such as www.firebas-ipsum.web.app
.
When host application tries to get file www.firebas-ipsum.web.app/remoteEntry.js
as expected we received CORS error.
How can we enable CORS for fetching any files? I tried solution in CORS issue but it is for requests, not for files.
Found solution by adding headers to firebase.json.
{
"hosting": {
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**/**",
"headers": [
{
"key": "Access-Control-Allow-Origin",
"value": "*"
}
]
}
]
}
}
For more information Offical Docs