-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7faa20
commit 98e0e51
Showing
6 changed files
with
131 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,20 @@ app.use(express.static('uploads')); | |
// Set security headers | ||
app.use(helmet()); | ||
|
||
// cookie | ||
app.use(cookieParser()); | ||
Check failure Code scanning / CodeQL Missing CSRF middleware High
This cookie middleware is serving a
request handler Error loading related location Loading This cookie middleware is serving a request handler Error loading related location Loading This cookie middleware is serving a request handler without CSRF protection. This cookie middleware is serving a request handler without CSRF protection. |
||
|
||
// CORS | ||
app.use(cors()); | ||
// app.use(cors()); | ||
app.use(cors({credentials:true,origin:process.env.FRONTEND_URL})); | ||
|
||
app.use(function(req, res, next) { | ||
res.header('Access-Control-Allow-Credentials', true); | ||
res.header('Access-Control-Allow-Origin', process.env.FRONTEND_URL); | ||
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,UPDATE,OPTIONS'); | ||
res.header('Access-Control-Allow-Headers', 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept'); | ||
next(); | ||
}); | ||
|
||
// Body Parser | ||
app.use(express.json({ limit: '50mb' })); | ||
|
@@ -25,8 +37,6 @@ app.use(express.urlencoded({ limit: '50mb', extended: true })); | |
// Response time | ||
app.use(responseTime({ suffix: false })); | ||
|
||
// cookie | ||
app.use(cookieParser()); | ||
|
||
// Use routes | ||
app.use('/', routes); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters