我想在我的主网站上配置一个子域。例如,www.something.com
和something.com
重定向到同一个主网站。
我想添加hi.something.com
,为此,我在我的nodejs应用程序vHost上使用了。
var vhost = require('vhost');
app.use(vhost('hi.something.com', require('./routes/hiIndex')));
//In (./routes/hiIndex) theres just an app.get telling it which page to render when it reaches this URL
在本地测试时,它可以工作,但一旦我将应用程序部署到heroku并尝试访问hi.something.com
,它就不能工作了,它将我重定向到主网站,即something.com
我是否需要添加一些额外的配置,也许是在google域的DNS设置上,或者在heroku上?
如果是,我是否只是将其指向something.com
??
我曾与重定向到其他网站的形式的子域名,但这是我第一次尝试使它从我自己的应用程序工作。
您可能有一个子域catch-all重定向,它阻止node.js中的vhost拾取子域。尝试在您的DNS设置中添加一个A类型记录,该记录指向您的Herokus服务器。