Skip to content
Snippets Groups Projects
Commit a3997b77 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

feat(server): allow server to read broken down client url for cors

parent 3db21d6a
No related branches found
No related tags found
No related merge requests found
......@@ -57,15 +57,18 @@ const configureApp = app => {
}
// Allow CORS from client if host / port is different
if (
config.has('pubsweet-client.host') &&
config.has('pubsweet-client.port')
) {
if (config.has('pubsweet-client.host')) {
const clientProtocol = config.get('pubsweet-client.protocol') || 'http'
const clientHost = config.get('pubsweet-client.host')
const clientPort = config.get('pubsweet-client.port')
const clientUrl = `${clientProtocol}://${clientHost}${
clientPort ? `:${clientPort}` : ''
}`
app.use(
cors({
origin: `${config.get('pubsweet-client.host')}:${config.get(
'pubsweet-client.port',
)}`,
origin: clientUrl,
credentials: true,
}),
)
......
This diff is collapsed.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment