jitar icon indicating copy to clipboard operation
jitar copied to clipboard

Add support multi-domain CORS

Open petermasking opened this issue 1 year ago • 0 comments

Our current CORS middleware implementation supports a single domain only. The next step is to add support for multiple domains.

For the implementation we need to add the domain of the request to the middleware, and update the CORS implementation to accept a list of origins:

startServer(moduleImporter).then(server =>
{
    server.addMiddleware(new CorsMiddleware('domain1, domain2, ...'));
});

The CORS implementation can then simply check if the request domain is in the list of origins and set the headers accordingly.

petermasking avatar Apr 12 '23 10:04 petermasking