흐음.. 캐싱할때 이걸 어떻게 상태로 캐싱을 해놓으면 되려나..
app.use(function forceLiveDomain(req, res, next) { // Don't allow user to hit Heroku now that we have a domain var host = req.get('Host'); if (host === 'serviceworker-cookbook.herokuapp.com') { return res.redirect(301, 'https://serviceworke.rs/' + req.originalUrl); } return next(); }); |
[링크 : https://davidwalsh.name/express-redirect-301]
[링크 : https://stackoverflow.com/questions/7450940/automatic-https-connection-redirect-with-node-js-express]
res.redirect([status,] path) Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”. |
'Programming > node.js' 카테고리의 다른 글
npm-run-all 병렬 빌드 (실패) (0) | 2019.05.29 |
---|---|
pdf 내용 추출 (0) | 2019.05.27 |
node.js 항목 확인 (0) | 2019.04.23 |
proxy error: Error: write after end (0) | 2019.04.23 |
node.js 시그널 핸들링과 reload (0) | 2019.04.23 |