有没有办法在express web服务器上更改请求的主机名?假设我有一个可以通过以下URL点击的web服务器:
https://servername.company.location.com/login 和 https://servername/login
有没有办法路由所有使用“ https://servername/login “收件人” “?我知道这可以通过apache通过RewriteRule和.htaccess文件来完成。
谢谢
您可以使用 res.redirect
// purely an example, implementation is up to you app.get('/login', function (req, res) { res.redirect('https://servername.company.location.com/' + req.path); });