问题
I'd like to use Omniauth 2 gem to authenticate users, but my problem is the callback uri contains the nginx used port 8082, which is hidden to outside. That's why the auth provider would like to redirect the user to hostname:8082, which is dropped.
I tried to rewrite http header, change X-Forwarded-Port, Host, Server-Port attributes (I checked my request object in Rails, and the Server-Port contained the 8082 port number only), but no success. I don't want to modify my application's code, I want to solve it at the webserver's layer.
Do you know any solution to Rails believe his port is 80 when passing the redirect url?
Thanks!
来源:https://stackoverflow.com/questions/5206616/changing-callback-uri-of-omniauth-in-rails