NodeJS 헤더 설정 으로 도 메 인 문제 해결

577 단어
app.all('*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
if (req.method == 'OPTIONS') {
res.send(200);
} else {
next();
}
});

다음으로 전송:https://www.cnblogs.com/davidpan/p/5563816.html

좋은 웹페이지 즐겨찾기