Search code examples
ruby-on-railsruby-on-rails-4ngrok

Detect ngrok from Rails


I am using ngrok in order to test my Rails application integration with PayPal.

Since my application works with subdomains, I would like to detect when call is made from ngrok so I can apply a different behaviour.

Is there any way to configure ngrok to pass some information so I can detect the call comes from there? Or any other way to know that ngrok stands behind the call?


Solution

  • Within your controller, you could check the request.host, which would have something related to ngrok somewhere there.

    Or look at this older SO question which uses a route constraint.