ruby-on-rails - 用于多租户应用程序(子域)的 ngrok + stripe webhook
问题描述
我目前正在测试一个多租户应用程序。当用户注册帐户时,会为该帐户创建一个子域。成功创建后,会发生以下过程:
帐户控制器
def create
@account = Account.new(account_params)
if @account.save
sign_in(@account.owner)
flash[:notice] = "Your account has been created."
redirect_to root_url(subdomain: @account.subdomain)
else
flash.now[:alert] = "Sorry, your account could not be created."
render :new
end
end
用户被重定向到他们的帐户,网址现在是 subdomain.url.com
以上内容在开发中与 lvh.me 配合得很好,但是当我使用 ngrok 进行测试时 - 用于测试条带网络书 - 我的 ngrok 隧道地址与正在设置的子域冲突。
我的条纹电子书看起来像这样: https ://3abg89zc.ngrok.io/webhooks/stripe
创建帐户后,我的网址将转到:https ://subdomain.ngrok.io/
解决方案
我相信这里的答案可能有效: 如何通过 ngrok 访问子域?
但是,我发现使用 heroku 在实时环境中进行测试更容易。
推荐阅读
- android - TextView 没有与其他视图内联
- c - 我不明白这句话的逻辑“cur = prev->next;” 在 deleteall(key) 函数中
- elasticsearch - 在多字段弹性搜索中设置值
- java - 内部错误:带包的符号文件不能为空
- android - 当另一个设备前台时,我应该停止发送推送通知吗?
- javascript - 正则表达式查找不带引号的 json 值
- android - Firebase 意图不起作用
- postgresql - 通过本地互联网通过 PGAdmin 访问 Postgres Docker DB
- ios - autorelease 对象什么时候释放?
- hibernate - Spring Data 中的命名实体图命名范围