用于多租户应用程序的ngrok +条带化Webhook(子域)

时间:2019-02-06 18:14:27

标签: ruby-on-rails devise stripe-payments multi-tenant

我有一个正在测试的多租户应用程序。当用户注册帐户时,将为该帐户创建一个子域。创建成功后,将发生以下过​​程:

客户经理

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

用户被重定向到其帐户,其URL现在为subdomain.url.com

上面的代码在lvh.me开发中非常有用,但是当我使用ngrok进行测试时-用于测试条状Webook-我的ngrok隧道地址与正在设置的子域冲突。

我的条纹webook看起来像这样: https://3abg89zc.ngrok.io/webhooks/stripe

创建帐户后,我的网址将转到:https://subdomain.ngrok.io/

1 个答案:

答案 0 :(得分:0)

我相信这里的答案可能有用: How can I access a subdomain through ngrok?

但是,我发现通过使用heroku在实时环境中进行测试更容易。