Devise omniauth-facebook redirect_uri isn't an absolute URI

thanks a lot for the advise. I migrated to Heroku and I have the following problem with facebook omniauth authentication. When I authenticate with facebook the callback URL does not work and I get sent to the homepage with the following log error message :

“redirect_uri isn’t an absolute URI. Check RFC 3986.”,“type”:“OAuthException”,“code”:191,“fbtrace_id”:“BT1wrRRo64m” method=GET path="/" request_id=8913218f-703d-4da0-9388-f59d3a97bb69 fwd=“” dyno=web.1 connect=0ms service=11ms status=200 bytes=13425


In development the functionality works when I set callback-url in devise.rb and in the facebook App settings to

So to give a more detailed log (I omitted not important infos):

  1. I click on the link for the sign in

method=GET path="/users/sign_in" fwd=“” status=200

  1. I click for the sign in with facebook

method=GET path="/users/auth/facebook" fwd=“” status=302 INFO – omniauth: (facebook) Request phase initiated.

  1. Callback from facebook, I notice that the path does not include my host

method=GET path="/users/auth/facebook/callback?code=‘sometoken’" fwd=“”

I already searched Stackoverflow for a solution and I followed this instructions
Devise omniauth-facebook redirect_uri Url must absolute

  1. I added :client_options
  2. I configured the absolute path like so in devise.rb

callback_url: ENV[‘SERVER_ROOT’]+’/users/auth/facebook/callback’

  1. In heroku settings I added the SERVER_ROOT env variable

I have also the following doubts, as I had many problems with env Varibles, I installed foreman
gem for my development. Foreman works as my webserver and loads the ENV
Variables from a env file. I have also a Procfile with the follwing code:

web: bundle exec rails s .env Procfile


The problem is that production still runs with puma and without Procfile

=> Booting Puma => Rails 5.0.1 application starting in production on => Run rails server -h for more startup options [4] Puma starting in cluster mode…


Thanks a lot for your help
Please give me a comment or just any tip to help me solve this

Fabrizio Bertoglio

I found the solution of the Problem at the following link.