Skip to content

Commit abbde14

Browse files
committed
fix: public api to allow access for credentials to all origins
1 parent ee48924 commit abbde14

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

apps/public-api/src/app.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,19 @@ const mailRoute = require('./routes/mail');
6161
const healthRoute = require('./routes/health');
6262

6363
// ROUTES SETUP
64-
app.use('/api/userAuth', limiter, logger, userAuthRoute);
65-
6664
const projectCorsPreflight = (req, res, next) => {
6765
res.header("Access-Control-Allow-Origin", req.headers.origin || "*");
6866
res.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, PATCH");
6967
res.header("Access-Control-Allow-Headers", "Content-Type, Authorization, x-api-key");
68+
res.header("Access-Control-Allow-Credentials", "true");
7069
if (req.method === 'OPTIONS') {
7170
return res.status(200).end();
7271
}
7372
next();
7473
};
7574

75+
app.use('/api/userAuth', projectCorsPreflight, limiter, logger, userAuthRoute);
76+
7677
app.use('/api/data', projectCorsPreflight, limiter, logger, dataRoute);
7778
app.use('/api/schemas', projectCorsPreflight, limiter, logger, schemaRoute);
7879
app.use('/api/storage', projectCorsPreflight, limiter, logger, storageRoute);

0 commit comments

Comments
 (0)