How to force Single Sign-On to use https on port 443



I have set up an Ruby on Rails application that uses Twitter for single sign-on.

In my twitter configurations, my call back looks like the following:

But the redirect code from has the following code in the html:

<meta http-equiv="refresh" content="0;url=https://somesite:80/users/auth/twitter/callback?oauth_token=someoauthtoken&oauth_verifier=someoauthverifier">

How do I force Twitter Single Sign-On to use https on port 443? Or just leave off the port 80 in the redirect?

I tried changing the callback setting in my twitter account to but it still uses port 80 on the redirect.

Any help would be greatly appreciated.


Does anyone have a Ruby on Rails application using https with a twitter callback? Are you not suppose to use https if you are using twitter for single sign on?

Why can't I use localhost as my OAuth callback?

So for anyone going through this problem, here is what solve the problem form me.

I added some middleware that just changes the server port to 443

env['SERVER_PORT'] = '443' unless env['SERVER_PORT'] == '443'
Somewhere on the web server I am using, env['SERVER_PORT'] was set to 80. Twitter was using this value on the callback.

There is probably a web server setting that can be changed, but I do not have access to make that change, so this will have to do.

Hope this helps someone.