Q:

Omniauth sign in adds extra port to auth url

I am using the omniauth-facebook, omniauth-twitter, omniauth-google-oauth2 gems 
for signing in, on localhost everything works fine, but in production it adds the port number 5050 to the authorization url, has anybody encountered this problem?
My site url is addthis.com
Twitter url
http://addthis.com:5050/users/auth/twitter/callback?oauth_token=krnYyA5BzM4JlCc5XVxuhsdfspArsdfgtkrUzajMts&oauth_verifier=MjLR9fPSV7aWThOe80oDuPBpB6pvVdBijKMMLdxifR4
Facebook url: 
https://www.facebook.com/dialog/oauth?client_id=213027215529249&redirect_uri=http%3A%2F%2Faddthis.com%3A5050%2Fusers%2Fauth%2Ffacebook%2Fcallback&response_type=code&scope=email&state=1bf3f21df9be97337asdfasdfsda4995bdf9982f321d
Google url
The redirect URI in the request: http://addthis.com:5050/users/auth/google_oauth2/callback did not match a registered redirect URI

A:

Omniauth in response included port used internally by nginx
this blog helped me a lot
http://awesomeprogrammer.com/blog/2012/12/09/dealing-with-omniauth-redirect-uri-mismatch-invalid-port-number-gotcha/

