Skip to content

Commit

Permalink
updated header options
Browse files Browse the repository at this point in the history
  • Loading branch information
jazicorn committed Oct 5, 2023
1 parent 9bc708e commit ff6dfa9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions apps/api/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@ class App {
}));
this.app.use(bodyParser.json());
this.app.use(cookieParser());

this.app.options("*", (req, res) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "PUT, POST, GET, DELETE, OPTIONS");
res.setHeader("Access-Control-Allow-Methods", "PUT, PATCH, POST, GET, DELETE, OPTIONS");
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
res.sendStatus(204);
});
this.app.use(cors({
origin: this.corsOptions
}));
this.app.use( "/", (req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
next();
});
// this.app.use( "/", (req, res, next) => {
// res.setHeader('access-control-allow-origin', '*');
// res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
// res.setHeader('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
// next();
// });
// this.app.set('trust proxy', 1) // trust first proxy
// this.app.use(session({
// secret: process.env.SECRET_TOKEN,
Expand Down

0 comments on commit ff6dfa9

Please sign in to comment.