# Yahoo login for Discourse

**URL:** https://meta.discourse.org/t/yahoo-login-for-discourse/74060
**Category:** Bug
**Created:** [November 14, 2017, 4:20pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060 "2017-11-14T16:20:47Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Neil\_Brooks2](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@Neil\_Brooks2](https://meta.discourse.org/u/Neil_Brooks2)
#### Post date: [November 14, 2017, 4:20pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/1 "2017-11-14T16:20:47Z")

</div>

Hi,

I’ve configured many of the social networks so that users can log in using them, however the Yahoo login doesn’t seem to work. I’ve enabled yahoo logins (there is no API client ID or secret) and when I test it, I get a “502 bad gateway” error. The URL I’m redirected to is https://[domainname]/auth/yahoo

I have read in other posts that yahoo logins might be temperamental. Can you help?

---

<div class="post-metadata">

### Author: ![nixie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nixie/32/82174_2.png) [@nixie](https://meta.discourse.org/u/nixie)
#### Post date: [November 14, 2017, 4:21pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/2 "2017-11-14T16:21:59Z")

</div>

I’ve noticed this in my site.  
Received complaints from a lot of users.

I don’t think anything can be done from Discourse end. Its a Yahoo issue. They need to fix it afaik.  
Finally, I had to disable Yahoo logins.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 14, 2017, 4:26pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/3 "2017-11-14T16:26:47Z")

</div>

> [@Neil\_Brooks2](#):
>
> I’ve enabled yahoo logins (there is no API client ID or secret) and when I test it, I get a “502 bad gateway” error. The URL I’m redirected to is https://[domainname]/auth/yahoo

Hmm. I’m going to recategorize this as a 🐛. Try redirects to [https://try.discourse.org/auth/yahoo](https://try.discourse.org/auth/yahoo) with a Bad Gateway. That doesn’t’ seem like the normal “Yahoo is broken” state of affairs.

> [@nixie](#):
>
> Finally, I had to disable Yahoo logins.

That seems like the best solution. It works sometimes, but not others.

---

<div class="post-metadata">

### Author: ![Neil\_Brooks2](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@Neil\_Brooks2](https://meta.discourse.org/u/Neil_Brooks2)
#### Post date: [November 14, 2017, 4:54pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/4 "2017-11-14T16:54:11Z")

</div>

Do I need to do anything ie. raise a bug report?

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 14, 2017, 9:17pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/5 "2017-11-14T21:17:48Z")

</div>

I’ll take a quick look and see if there’s anything going on.

EDIT:

I tried a whole bunch of times, and on the VERY FIRST it failed with bad gateway. Then every single time it worked, both in incognito and in my normal browser.

Haven’t been able to make it fail again.

I do see these in the logs and I’m wondering if they have anything to do with it, but I doubt it. Still, it’s noise.

```plaintext
ActionController::RoutingError (No route matches [HEAD] "/auth/yahoo")
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call'
{"method":"HEAD","path":"/404","format":"html","controller":"ExceptionsController","action":"not_found","status":404,"duration":15.89,"view":0.16,"db":4.64,"params":"","database":"default","@timestamp":"2017-11-14T16:25:15.404Z","@version":"1","message":"[404] HEAD /404 (ExceptionsController#not_found)"}

```

Also, I’m seeing this in many places:

```plaintext
2017/11/14 08:40:21 [error] 10747#10747: *932261555 upstream sent too big header while reading response header from upstream, client: [proxy], server: *.discourse.org, request: "GET /auth/yahoo HTTP/2.0", upstream: "http://[internal-server]:444/auth/yahoo", host: "try.discourse.org", referrer: "https://try.discourse.org/t/testing-a-topic/892"

```

```plaintext
2017/11/14 05:43:31 [error] 2021#2021: *760816468 upstream sent too big header while reading response header from upstream, client: [proxy], server: community.[customer].com, request: "GET /auth/yahoo HTTP/2.0", upstream: "http://[internal-server]:444/auth/yahoo", host: "community.[customer].com", referrer: "https://community.[customer].com/c/tutorials"

```

I don’t have a smoking gun - this could just be the “usual temperment of yahoo logins” but I’ll check.

EDIT again:

Visiting [https://try.discourse.org/auth/yahoo](https://try.discourse.org/auth/yahoo) while logged in was causing the 502 errors for a while, but now it’s not.

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [November 14, 2017, 10:56pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/6 "2017-11-14T22:56:24Z")

</div>

“upstream sent too big header” doesn’t seem very healthy. Perhaps we need to bump up `client_header_buffer_size`, or (more likely) `large_client_header_buffers`. The `RoutingError` seems more relevant to this particular problem, though; that would emit a 5xx response.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 14, 2017, 11:00pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/7 "2017-11-14T23:00:38Z")

</div>

> [@mpalmer](#):
>
> The RoutingError seems more relevant to this particular problem, though; that would emit a 5xx response

It’s for a HEAD request… which seems out of place to the flow.

> [@mpalmer](#):
>
> “upstream sent too big header” doesn’t seem very healthy

```plaintext
$ curl -v https://try.discourse.org/auth/yahoo

```

wow that’s sending back an enormous cookie… that Set-Cookie header at the moment is 2153 chars… that’s big… maybe sometimes it’s bigger and tripping a limit?

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 14, 2017, 11:16pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/8 "2017-11-14T23:16:42Z")

</div>

AHAH!

For whatever reason, when you navigate to the main page of [https://try.discourse.org](https://try.discourse.org) and go through the login process, it works.

But if you navigate to a topic, then try logging in, you get a Bad Gateway error from try.

Note that _loading try already in a topic_ and logging in still works, it’s only after you’ve navigated that it throws an error.

This has been reproducible for me every time I try it.

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [November 14, 2017, 11:20pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/10 "2017-11-14T23:20:43Z")

</div>

Nice one. Reproducible problems ftw.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 15, 2017, 4:37pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/11 "2017-11-15T16:37:37Z")

</div>

@Neil_Brooks2 Can you point us at a site not hosted by us with this problem and let us know what kind of install it is?

---

<div class="post-metadata">

### Author: ![Neil\_Brooks2](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@Neil\_Brooks2](https://meta.discourse.org/u/Neil_Brooks2)
#### Post date: [November 15, 2017, 4:53pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/12 "2017-11-15T16:53:04Z")

</div>

Its a site that is hosted with you. does that make a difference?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 15, 2017, 6:32pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/13 "2017-11-15T18:32:13Z")

</div>

I just tried on a [standard install](https://meta.discourse.org/t/142537?silent=true) and a multisite install with caddy server reverse proxying.

Both of them worked. I’m pretty sure that neither site had been updated since this thread started.

Maybe yahoo is working today?

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 16, 2017, 6:26pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/15 "2017-11-16T18:26:28Z")

</div>

> [@Neil\_Brooks2](#):
>
> Its a site that is hosted with you. does that make a difference?

It does make a difference, actually.

The actual problem was that in our environment the size of the headers sent back by Discourse for the request going to /auth/yahoo are very large - 3897 bytes.

BUT when navigating around before trying to login, the headers (one of which is the cookie that has some pre-login session state) gets larger, e.g. up to a size of 4142 bytes. This is larger than the [buffer which nginx allocates](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffer_size) for holding that first part of the response.

Upping the size of `proxy_buffer_size` to 8k was necessary for our infrastructure and has solved the problem on [try.discourse.org](http://try.discourse.org).

@Neil_Brooks2, please let me know (in a PM) which sites are yours and I will ensure those are deployed next, we can continue testing there and then we’ll roll out the change to everyone.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 10, 2017, 10:31pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/17 "2017-12-10T22:31:48Z")

</div>

Implemented in base per:

[https://github.com/discourse/discourse/commit/394abbe26b62644957a791dce7a25989be888861](https://github.com/discourse/discourse/commit/394abbe26b62644957a791dce7a25989be888861)

If you are running an outer nginx container be sure to also follow the change there

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 10, 2017, 10:31pm UTC](https://meta.discourse.org/t/yahoo-login-for-discourse/74060/18 "2017-12-10T22:31:51Z")

</div>


