Skip to main content

CORS configuration

By default the server only accepts requests from the same origin.

You can configure this by providing a corsOption object into the server constructor.

corsOption shares the same properties as the cors npm module.

Note

Since the server relies on authentication cookies to be present, setting * for origin will not work as * is not a permitted value when credentials are set. Instead, set it to true

Examples#

Allowing a single origin#

const server = new CollabServer({
corsOption: {
// only allow requests from http://your-domain.com
origin: 'http://your-domain.com'
}
})

Allowing all origins#

const server = new CollabServer({
corsOption: {
// reflects all origins
origin: true
}
})