특정 IP로만 접근을 허용하거나 차단해야 하는 경우가 있다. Node.js와 Express.js 환경에서 어떻게 하는지 알아보자. 특정 IP 설정 const ips = ['127.0.0.1','127.0.0.2']; 접근 허용 const allowIPs = (ips) => { return (req, res, next) => { const clientIP = req.headers['x-forwarded-for'] || req.socket.remoteAddress; if (ips.includes(clientIP)) { next(); } else { res.status(403).send('접근 차단'); } }; }; app.use(allowIPs(ips)); 접근 차단 const blockIPs = (ips..