如何强制 Twitter 单点登录在端口 443 上使用 https [英] How to force Twitter Single Sign-On to use https on port 443

查看:66
本文介绍了如何强制 Twitter 单点登录在端口 443 上使用 https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个使用 Twitter 进行单点登录的 rails 应用程序.

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

在我的 Twitter 配置中,我的回调如下所示:https://somesite.com/users/auth/twitter

In my twitter configurations, my call back looks like the following: https://somesite.com/users/auth/twitter

但是来自 https://api.twitter.com/oauth/authenticate?oauth_token=someoauthtoken 的重定向代码在 html 中有以下代码:

But the redirect code from https://api.twitter.com/oauth/authenticate?oauth_token=someoauthtoken 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">

如何强制 Twitter 单点登录在端口 443 上使用 https?

How do I force Twitter Single Sign-On to use https on port 443?

我尝试将我的 twitter 帐户中的回调设置更改为 https://somesite.com:443/users/auth/twitter,但它仍然在重定向时使用端口 80.

I tried changing the callback setting in my twitter account to https://somesite.com:443/users/auth/twitter but it still uses port 80 on the redirect.

任何帮助将不胜感激.

有没有人有使用 https 和 twitter 回调的 Ruby on Rails 应用程序?如果您使用 twitter 进行单点登录,您不应该使用 https 吗?

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?

推荐答案

所以对于任何遇到这个问题的人,这里是解决我问题的方法.

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

我添加了一些中间件,只是将服务器端口更改为 443

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

env['SERVER_PORT'] = '443' unless env['SERVER_PORT'] == '443'

在我使用的 Web 服务器上的某个地方,env['SERVER_PORT'] 设置为 80.Twitter 在回调中使用了这个值.

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

可能有一个 Web 服务器设置可以更改,但我无权进行更改,因此必须这样做.

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.

这篇关于如何强制 Twitter 单点登录在端口 443 上使用 https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆