0
我有一個做以下NGINX + Node.js的res.redirect( '../路徑')
app.get('/', function (req, res) {
res.redirect('../Path');
});
app.get('/Path, function(req, res){
res.render('page');
});
要<servername>:<port>/
重定向到<servername>:<port>/Path
和頁面加載節點應用
這工作正常。現在我加入NGINX的方程和我想要的位置LOCATION1下我所有的節點路徑,所以我有這個在NGINX:
location /Location1/ {
proxy_pass http://localhost:port/
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
,如果我直接去<servername>/Location1/Path
工作正常,但如果我嘗試不工作去<servername>/Location1
它重定向到<servername>/Path1
我認爲../Path
在重定向是爲相對URL,但顯然它不起作用在這種情況下。我究竟做錯了什麼?