ngrok, pow, and devise causes redirect to local URL after sign in on Rails 4

1.7k views Asked by At

I'm running ngrok, pow, and using devise for authentication on my Rails 4.2.1 application. When I run it locally by going to http://myapp.dev, pow works fine all across the board. I can sign in, view pages, etc.

When I set up an ngrok proxy, I get the first login page correctly (by hitting http://123.ngrok.io), and can see that it's hitting my local app. However, after I sign in, I get redirected from http://123.ngrok.io to http://myapp.dev and prompted to sign in again. My 'after_sign_in_path` is set to return a path in my app, and it works when I do it locally.

Any ideas where that interaction is failing?

1

There are 1 answers

0
Jason Knebel On

You can set your host name so the redirect doesn't happen in default_url_options

class ApplicationController < ActionController::Base
...
  def default_url_options
    { host: 'hostname.com' }
  end
...
end