Open pganster opened 7 months ago
use the below server configuration in vite. Run the app in preview mode to get the remoteEntry file generated for testing in local server:{ port: 5174, cors: { origin: "*", methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"], allowedHeaders: ["X-Requested-With", "content-type", "Authorization"],
},
},
Any solution?
As a workaround, you can use this pattern. And directly change the domain
of the cookies in developer tools to the domain you want to send requests to.
Is your feature request related to a problem? Please describe.
Currently, it is impossible to fetch a remoteEntry.js from a remote that is hosted on a different authenticated domain than the host as the Cookie of the different domain is not included.
Generally in Javascript, one can use the
credentials: 'include'
option, to fetch a file from a different authenticated domain via the Fetch API, see here. Similarly, a script from another authenticated domain can be included, by settingcrossorigin="use-credentials"
to a tag, see here.Describe the solution you'd like
I'd love to see a property added to
Remote
that enables that script to be fetched from a different domain with credentials. For exampleDescribe alternatives you've considered
As soon as you include a tag with
crossorigin="use-credentials"
in the<head />
, all subsequent imports will also include the credentials when fetching that script, no matter if they have crossorigin set or not.By building upon this behavior, we've built the following workaround, which includes a script tag, and afterwards resolves the promise, so that the federation plugin can do it's work by importing the URL, where that request in turn will then include the credentials.
But of course, this should be the job of the federation plugin, so I'm hoping a feature like this will be included.