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

fix(server): register cors before static endpoints

parent 6232cb5f
No related branches found
No related tags found
2 merge requests!52Docx,!17Graphql api
...@@ -51,6 +51,11 @@ const configureApp = app => { ...@@ -51,6 +51,11 @@ const configureApp = app => {
app.use(bodyParser.urlencoded({ extended: false })) app.use(bodyParser.urlencoded({ extended: false }))
app.use(cookieParser()) app.use(cookieParser())
app.use(helmet()) app.use(helmet())
// Allow CORS from client if host / port is different
const CORSConfig = createCORSConfig()
app.use(cors(CORSConfig))
app.use(express.static(path.resolve('.', '_build'))) app.use(express.static(path.resolve('.', '_build')))
app.use(express.static(path.resolve('.', 'static'))) app.use(express.static(path.resolve('.', 'static')))
...@@ -61,10 +66,6 @@ const configureApp = app => { ...@@ -61,10 +66,6 @@ const configureApp = app => {
) )
} }
// Allow CORS from client if host / port is different
const CORSConfig = createCORSConfig()
app.use(cors(CORSConfig))
// Register passport authentication strategies // Register passport authentication strategies
app.use(passport.initialize()) app.use(passport.initialize())
const authentication = require('pubsweet-server/src/authentication') const authentication = require('pubsweet-server/src/authentication')
......
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