title: Ruby on Rails 5: redirect_to giving url and path
body: <p>I am building a rails 5 web app. Everything is working great on my localhost development environment.  I have a Digital Ocean dropplet (running Ubuntu 14.04, nginx/puma, and mySql).  As per the normal sequence, after one logs in, I redirect to the root_path.  Again on my localhost environment, this works as expected, but on the remote host (still under development environment) the redirect_to function gives both the url and the path. </p>
  
  <p>here is my login controller code:</p>
  
  <pre><code>class SessionController &lt; ApplicationController
    def login
      user = User.find_by_uname params[:uname]
      if user.present?
        @user = user.authenticate(params[:password])
        if @user.present?
          puts "@user present"
          session[:userid] = @user.id
          session[:uname] = @user.uname
          @modal = 'login'
          redirect_to root_path
        else
          puts "@user did not authenticate -- wrong password"
        end
      else
        puts "#{params[:uname]} not in database."
        render partial: 'utility/loginfailure', as: :js
      end
    end
  end
  </code></pre>
  
  <p>in the log/development.log file I see this:</p>
  
  <blockquote>
    <p>Redirected to <a href="http://ruby.morgotha.net" rel="nofollow noreferrer">http://ruby.morgotha.net</a>, ruby.morgotha.net/</p>
  </blockquote>
  
  <p>From that it would seem to be coming from the redirect method, but it works fine on localhost dev.  </p>
  
  <p>I am not sure how to troubleshoot this anymore. So if someone is willing to guide me on digging into this a bit deeper, I sure would appreciate it. </p>
  
  <p><strong>Edit</strong> I changed the session controller to not need the return statement. The problem is still happening.  root_path resolves to just "/". </p>