Skip to content

Commit

Permalink
fix: update cors (10)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafirm29 committed Aug 16, 2022
1 parent 0d61543 commit 79b779c
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,11 @@ import * as cors from 'cors';

const app = express();

app.use((req, res, next) => {
next();
res.header('Access-Control-Allow-Origin', '*');
res.header(
'Access-Control-Allow-Methods',
'GET,HEAD,PUT,POST,OPTIONS,UPDATE,DELETE'
);
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept, Authorization, token'
);
});

app.use(
cors({
origin: '*',
origin: 'https://preview-social.katitb22.com',
credentials: true,
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
optionsSuccessStatus: 200,
maxAge: 0,
})
);

Expand All @@ -45,7 +30,7 @@ const httpServer = createServer(app);

const io = new Server(httpServer, {
cors: {
origin: '*',
origin: 'https://preview-social.katitb22.com',
credentials: true,
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
},
Expand Down

0 comments on commit 79b779c

Please sign in to comment.