diff --git a/src/common/modules/express/index.js b/src/common/modules/express/index.js index e67048a..03eee00 100644 --- a/src/common/modules/express/index.js +++ b/src/common/modules/express/index.js @@ -37,10 +37,14 @@ module.exports = expressLoader = (app) => { origin: (origin, callback) => { if ( // whitelist에 있는 origin 허용 - (origin && conf.corsWhiteList.indexOf(origin) !== -1) || - // postman 허용 - (!origin && - conf.corsUserAgent.split(',').some((agent) => req.headers['user-agent'].includes(agent))) + origin === undefined || + conf.corsWhiteList.indexOf(origin) !== -1 + // NOTE : EB Health Check도 origin undefind라 거부 당해서 임시 주석처리 + // // whitelist에 있는 origin 허용 + // (origin && conf.corsWhiteList.indexOf(origin) !== -1) || + // // postman 허용 + // (!origin && + // conf.corsUserAgent.split(',').some((agent) => req.headers['user-agent'].includes(agent))) ) { return callback(null, true); } diff --git a/src/common/utils/rateLimit.js b/src/common/utils/rateLimit.js index b29fdf9..4ebdda8 100644 --- a/src/common/utils/rateLimit.js +++ b/src/common/utils/rateLimit.js @@ -15,12 +15,13 @@ exports.postApiLimiter = rateLimit({ exports.commonLimiter = rateLimit({ windowMs: 60 * 1000, // 1분 간격 + // TODO : 100으로 줄이기 max: 1000, // windowMs동안 최대 호출 횟수 handler(req, res) { // 제한 초과 시 콜백 함수 res.status(this.statusCode).json({ code: this.statusCode, // statusCode 기본값은 429 - message: '1분에 50번만 요청 할 수 있습니다.', + message: '1분에 100번만 요청 할 수 있습니다.', }); }, }); diff --git a/src/routes/user/user.controller.js b/src/routes/user/user.controller.js index 520eaae..45e883f 100755 --- a/src/routes/user/user.controller.js +++ b/src/routes/user/user.controller.js @@ -360,6 +360,17 @@ exports.updateRequestState = async (req, res) => { exports.deleteUser = async (req, res) => { try { + const refreshToken = req.cookies.refreshToken; + if (refreshToken) { + try { + const email = req.user.email; + await redisClient.del(email); + } catch (err) { + console.error('Redis error:', err); + } + } + res.clearCookie('refreshToken', config.cookieInRefreshTokenDeleteOptions); + const { _id } = req.user; await wordService.deleteWordContributor(_id); await userService.deleteUser(_id); diff --git a/src/routes/user/user.route.js b/src/routes/user/user.route.js index 09aed0c..1e7b620 100644 --- a/src/routes/user/user.route.js +++ b/src/routes/user/user.route.js @@ -44,7 +44,6 @@ userRouter.delete('/:searchTerm', isLoggedIn, delRecentSearch); // 최근 검색 //등록 요청 userRouter.post('/requests/:nickname/new', isLoggedIn, postWords); -module.exports = userRouter; // 요청 조회 userRouter.get('/requests', isLoggedIn, UserRequests); // 요청 목록 조회 userRouter.get('/requests/all', isLoggedIn, UserRequestsAll); // 모든 요청 목록 조회