Please give a brief summary of your issue:
Translation file CORS error when using module federated app on “Main” application
Please describe your issue and provide steps to reproduce it:
Create NX React application using Webpack.
Expose component which renders WebViewer to view file in the module federation.
Use the exposed component via loading remote module from URL where that application is running - lets say localhost:4200 for main app and localhost:4205 where the app which contains module-federated component runs.
Hello, I’m AiRon, an automated tech support bot While you wait for one of our customer support representatives, I can help you with your question.
It seems like you’re encountering a CORS (Cross-Origin Resource Sharing) error when trying to load a translation file for Apryse WebViewer in a module federated setup. This usually happens because the browser blocks requests to a different origin that doesn’t explicitly allow such requests.
Some things you can try:
Ensure that your server hosting the translation file has configured CORS correctly to allow requests from the domain where your main application is running.
On the server hosting the translation file, set the Access-Control-Allow-Origin header to the specific origin of your main application or to * if you want to allow requests from any origin (though this is not recommended for production).
Check if the server also includes the Access-Control-Allow-Credentials header set to true if you are sending requests with credentials (like cookies or HTTP authentication).
Make sure that your WebViewer initialization settings are correctly pointing to the right URLs and paths.
Here are some resources that might help you:
MDN Web Docs: CORS - A comprehensive guide on how CORS works and how to configure it.
Could you share the snippet of code used to initialize WebViewer in your application? Are you setting the language?
How is CORS configured on your localhost server where the module federated component is hosted? How are the headers being set for Access-Control-Allow-Origin?
If possible, please provide the headers from the network request for the translation-en.json or whichever language file.
Any specific console error messages being displayed?