Fixing OmniAuth Redirecting to a URI with Port

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:

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 = ""