I have a multi-tenant application I am currently testing. When a user signs up for an account, a subdomain is created for the account. Upon successful creation, this process happens:
Accounts Controller
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
The user is redirected to their account with the url now being subdomain.url.com
The above works great with lvh.me in development, but when I use ngrok for testing - using to test stripe webooks - my ngrok tunnel address conflicts with the subdomain that is being set.
My stripe webook looks something like this: https://3abg89zc.ngrok.io/webhooks/stripe
When the account is created, my url goes to: https://subdomain.ngrok.io/