1
我有以下條件會話的NodeJS與問題www和非www
(1)如果我訪問https://example.com 如果去到登錄頁面。
(2)相同的,如果我參觀https://www.example.com 它進入到登錄頁面
現在我從https://example.com登錄重定向到儀表板頁面這是罰款。 ,再次當我訪問https://example.com它將我重定向到儀表板頁面。
現在問題當我訪問https // www.example.com它重定向到登錄頁面。
這意味着我能夠登錄兩會
1)https://example.com 2)https://www.example.com 在同一個瀏覽器。 ?
如何處理這一個請。
我也在使用http重定向。
http.createServer(function (req, res) {
res.writeHead(301, { "Location": "https://www." + req.headers['host'] + req.url });
res.end();
}).listen(80);
var secureServer = https.createServer(sslOptions,app).listen(443, function(err,result){
console.log("Express server listening on port : 443");
console.log("Mode : " + app.get('mode'));
});
有什麼建議嗎?
謝謝
你能否給我提供示例代碼 –