Fixing OmniAuth Redirecting to a URI with Port

2017-01-16

Came across this problem the other day when deploying a Rails application that is sitting behind Kubernetes and Deis

With my Rails application using OmniAuth and its Facebook strategy, after a user logins, hits Facebook and returns a redirection, the URL returned has its port 80 embedded in the return URI like: https://domain.com:80.

In most cases, this wouldn’t be a problem but Facebook would return an error as the return URI (with the port 80) is not whitelisted hence creating a bad flow for your user.

In order to fix this, you just need to tell OmniAuth where to redirect.

Just add the following in either your environments/*.rb file or create a new initializer file in your config/initializers.

OmniAuth.config.full_host = "https://domain.com"
I’m currently working on fyra.sh, a CLI-first static site deployment tool where you push your site and it’s served globally through a built-in CDN, without the overhead of heavy platforms.