Django的社会身份验证提供了502错误与谷歌的OpenID,但只有少数用户(django-soc

2019-10-18 14:26发布

我一直在争取与这就是被我逼疯了过去几周的错误。 请帮忙!

这里的症状:

如果用户没有到Gmail登录,他可以登录我的网站(使用Gmail的OpenID)没有问题。 这将oviously提示用户在GMail中首先进行身份验证。

但是,如果用户在Gmail中已经验证,他看到一个502错误页面,nginx的产生。

这仅发生在少数用户(我不是其中之一),其中一人还跟报告甚至做一个视频演示:

http://rvzt.net/Temp/google-freedomsponsors.webm

奇怪,不是吗?

我加了一些调试线Django的社会-auth的生产,试图了解发生了什么事情( 在这里 ,只是做按Ctrl + F +“记录仪”寻找我的变化)

在此设置下,健康的登录尝试将充斥我的(Django的)日志文件有这样的东西

2013-09-06 11:19:26,659 [DEBUG] social_auth.backends: auth_complete ARGS=(), KWARGS={...} 2013-09-06 11:19:26,666 [DEBUG] social_auth.backends: response and status <openid.consumer.consumer.SuccessResponse id='https://id.mixi.jp/10452407' signed=[u'openid.mode', u'openid.claimed_id', u'openid.identity', u'openid.op_endpoint', u'openid.return_to', u'openid.response_nonce', u'openid.assoc_handle', u'openid.ax.type.nickname', u'openid.ns.ax', u'openid.ax.mode', u'openid.ax.value.nickname']> / success 2013-09-06 11:19:26,675 [DEBUG] social_auth.views: got user: 5ca95b48317944cd87b7d5af4b6e77 2013-09-06 11:19:26,683 [DEBUG] social_auth.views: return redirect to: /

然而,这种特定用户登录尝试失败产生Django的日志文件中没有输出 。 因此,它甚至不触摸查看方法。

有上nginx的几个日志虽然。

下面是一个错误的登录尝试的样子(在/var/log/nginx/access.log):

```130.225.243.86 - - [03 /月/ 2013:13:23:39 0000]“GET /complete/google/?janrain_nonce=2013-09-03T13%3A23%XXXXXXXXXXX&openid.ns=http%3A%2F %2Fspecs.openid.net%2Fauth%2F2.0&openid.mode = id_res&openid.op_endpoint = HTTPS%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce = 2013-09-03T13%3A23%3A38Zh5WrngwxTu2ByQ&openid.return_to = HTTP%3A%2F%2Ffreedomsponsors.org%2Fcomplete%2Fgoogle%2F%3Fjanrain_nonce%3D2013-09-03T13%253A23%253XXXXXXXXXX&openid.assoc_handle = 1.AMlYXXXXXXXXXXXr5MKoxu-ķ-3cnkXXXXXXXXXXXXXXXXXXXXXXgdEpo3HOg&和openid.signed = op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce %2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.old_email%2Cext1.value.old_email%2Cext1.type.first_name%2Cext1.value.first_name%2Cext1.type.last_name%2Cext1.value.last_name%2Cext1.type .email%2Cext1.value.email&openid.sig = 3n46MUyn8wIIWpvYIJXj%2BeZqC7o%3D&openid.identity = HTTPS%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawmGmlrjd-OuXXXXXXXXXXXXXXXtIXGpMJQ&openid.claimed_id = HT TPS%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawmGmlrjd-OuXXXXXXXXXXXXXXXXIXGpMJQ&openid.ns.ext1 = HTTP%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode = fetch_response&openid.ext1.type.old_email = HTTP%3A%2F%2Fschema.openid.net%2Fcontact%2Femail&openid.ext1.value.old_email = xxxxxxxxx.junior%40gmail.com&openid.ext1.type.first_name = HTTP%3A%2F% 2Faxschema.org%2FnamePerson%2Ffirst&openid.ext1.value.first_name =巴斯蒂安&openid.ext1.type.last_name = HTTP%3A%2F%2Faxschema.org%2FnamePerson%2Flast&openid.ext1.value.last_name = Hougaard&openid.ext1.type.email = HTTP%3A%2F%2Faxschema.org%2Fcontact%2Femail&openid.ext1.value.email = xxxxxxxxx.junior%40gmail.com HTTP / 1.1" 502 575 “ http://freedomsponsors.org/login/google/ ”“的Mozilla / 5.0(X11; 的Linux x86_64的)为AppleWebKit / 537.36(KHTML,例如Gecko)铬/ 29.0.1547.62 Safari浏览器/ 537.36"

```

这始终是伴随着/var/log/nginx/errors.log就像一个条目:

2013/09/06 10:46:06 [error] 667#0: *116533 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 130.225.198.129, server: freedomsponsors.org, request: "GET //complete/google/?janrain_nonce=2013-09-03T13%3A23%XXXXXXXXXXX&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce=2013-09-03T13%3A23%3A38Zh5WrngwxTu2ByQ&openid.return_to=http%3A%2F%2Ffreedomsponsors.org%2Fcomplete%2Fgoogle%2F%3Fjanrain_nonce%3D2013-09-03T13%253A23%253XXXXXXXXXX&openid.assoc_handle=1.AMlYXXXXXXXXXXXr5MKoxu-_k_-3cnkXXXXXXXXXXXXXXXXXXXXXXgdEpo3HOg&openid.signed=op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.old_email%2Cext1.value.old_email%2Cext1.type.first_name%2Cext1.value.first_name%2Cext1.type.last_name%2Cext1.value.last_name%2Cext1.type.email%2Cext1.value.email&openid.sig=3n46MUyn8wIIWpvYIJXj%2BeZqC7o%3D&openid.identity=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawmGmlrjd-OuXXXXXXXXXXXXXXXtIXGpMJQ&openid.claimed_id=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawmGmlrjd-OuXXXXXXXXXXXXXXXXIXGpMJQ&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_response&openid.ext1.type.old_email=http%3A%2F%2Fschema.openid.net%2Fcontact%2Femail&openid.ext1.value.old_email=xxxxxxxxx.junior%40gmail.com&openid.ext1.type.first_name=http%3A%2F%2Faxschema.org%2FnamePerson%2Ffirst&openid.ext1.value.first_name=Bastian&openid.ext1.type.last_name=http%3A%2F%2Faxschema.org%2FnamePerson%2Flast&openid.ext1.value.last_name=Hougaard&openid.ext1.type.email=http%3A%2F%2Faxschema.org%2Fcontact%2Femail&openid.ext1.value.email=xxxxxxxxx.junior%40gmail.com HTTP/1.1", upstream: "uwsgi://unix:///tmp/frespo.sock:", host: "freedomsponsors.org", referrer: "http://freedomsponsors.org/login/google/"

良好的登录尝试看起来就像(access.log里),但相同的,而不是结尾

502 575 "http://freedomsponsors.org/login/google/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36"

它以结束

302 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36"

,当然,它不会产生任何error.log中的条目。

我的生产环境是一个标准的nginx + uswgi与文件插座,非常喜欢这个教程说- > https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

我appretiate任何帮助,您可以给!

Answer 1:

胜利!!!

研究了一点后,我发现,uwsgi有--daemonize选项,将引导uwsgi记录到文件中。

使在此之后,我开始看到像'无效请求块大小的错误:4167(最大4096)...跳过

于是,我又增加了配置选项: buffer-size = 8192和问题走了。

由于很多巴斯蒂安谁帮我调试这个问题!



文章来源: django-social-auth gives 502 error with Google OpenID, but only with a few users