如何在heroku上为应用程序创建子子域:(例如,sub.myapp.herokuapp.com) [英] How to create a subsubdomain for an app on heroku: (e.g. sub.myapp.herokuapp.com)

查看:126
本文介绍了如何在heroku上为应用程序创建子子域:(例如,sub.myapp.herokuapp.com)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个使用Heroku的租户的子域名的多租户应用程序。在制作中,我有一个域名,其中的子域名指向我的heroku应用程序。 (这一切工作正常)



对于分期,我想测试而不创建另一个域。由于我的应用程序使用第一个子域来查找当前的租户,因此我希望使用像tenant.myapp.herokuapp.com这样的URL。然而,这是行不通的(heroku返回'没有这样的应用程序'的错误。)



我发现这篇文章来自2年前,说这应该是可能的,但我没有看到这个附加/选项在参考文档中。



我曾尝试通过运行

添加子域作为heroku中的通配符
$ b

heroku domains:add * .myapp.herokuapp.com



但返回

!试图劫持另一个Heroku应用程序? Tsk,tsk。



有谁知道这是否仍然可以完成,如果是这样,怎么样?



注意:目前我正在使用CNAMING * .staging.myapp.com将my staging环境用于myapp.heroku.com,但希望清除它。

解决方案

以下是您如何在heroku中使用子域名 完整详情


自定义子域



对于要附加到应用程序的每个自定义子域(例如www.example.com),请使用域:从Heroku
CLI添加
命令:



  $ heroku域名:添加www.example.com` 
将www.example.com添加到示例中...完成






这已不再有效:子域目前不是 可能在heroku上


I am running a multi tenant app that uses subdomains for tenants on Heroku. In production I have a domain where subdomains point to my heroku app. (This all works fine)

For staging, I'd like to test without creating another domain. Since my app uses the first subdomain it sees to find the current tenant, I was hoping to use a url like: tenant.myapp.herokuapp.com. However, this is not working (heroku returns a 'no such app' error.)

I've found this post from 2 years ago that says it should be possible, but I don't see this add-on/option anymore in the referenced documentation.

I have tried adding the subdomains as a wildcard in heroku by running

heroku domains:add *.myapp.herokuapp.com

but this returned

! Trying to hijack another Heroku app? Tsk, tsk.

Does anyone know if this can still be accomplished and if so, how?

note: I'm currently using my staging environment by CNAMING *.staging.myapp.com to myapp.heroku.com, but would like to clean that up.

解决方案

Here's how you use subdomains with heroku

Full Details here

Custom subdomains

For each custom subdomain you want to attach to your app (for example, www.example.com), use the domains:add command from the Heroku CLI:

$ heroku domains:add www.example.com`
Adding www.example.com to example... done


This is no longer valid: "Subdomains are currently not possible on heroku"

这篇关于如何在heroku上为应用程序创建子子域:(例如,sub.myapp.herokuapp.com)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆