我可以在我的Heroku子域中使用子域名吗?
我有一个使用vhostpipe理子域的节点应用程序。 所以,在我的本地主机上,我有:
main.localhost admin.localhost api.localhost
在生产中我有:
main.example.com admin.example.com api.example.com
我也有一个Heroku的分期系统。
所以我想要做的是:
main.example.herokuapp.com admin.example.herokuapp.com api.example.herokuapp.com
这似乎并不奏效。 有没有办法实现它,还是我需要创build一个单独的域名并指向我的名称服务器?
当然这是可能的。 但是你需要通过你的主域来做到这一点,因为Heroku不支持herokuapp.com
域的通配符子域名。 ( 如何在heroku上为应用程序创build一个subsubdomain :(例如,sub.myapp.herokuapp.com) )
首先,为*.staging.example.com
设置一个CNAME
logging,指向example.herokuapp.com
然后告诉Heroku正确的路由你的域名:
$ heroku domains:add *.staging.example.com