0
我在Heroku上託管一個站點並利用其揹負式SSL。Expressjs res.redirect(...)將內容類型從json更改爲表單urlencoded
實施SSL某條線路,我使用此代碼:
app.all('/user/*', function(req, res, next) {
if(app.settings.env != "development" &&
req.headers['x-forwarded-proto'] != 'https') {
res.redirect('https://' + req.header('host') + req.url);
} else {
next();
}
});
重定向工作正常,所有的標題都存在。但是,內容類型從application/json更改爲application/x-www-form-urlencoded。
有誰知道這種行爲是有意的還是它的錯誤?有什麼我需要做的,以阻止內容類型改變?
感謝