# \`fetch\_response\` rejects HTTP 202 breaking IMDB oneboxes

**URL:** https://meta.discourse.org/t/fetch-response-rejects-http-202-breaking-imdb-oneboxes/407725
**Category:** Bug
**Tags:** onebox, fixed
**Created:** [July 15, 2026, 7:38pm UTC](https://meta.discourse.org/t/fetch-response-rejects-http-202-breaking-imdb-oneboxes/407725 "2026-07-15T19:38:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [July 15, 2026, 7:38pm UTC](https://meta.discourse.org/t/fetch-response-rejects-http-202-breaking-imdb-oneboxes/407725/1 "2026-07-15T19:38:44Z")

</div>

IMDB currently returns **HTTP 202 Accepted** instead of **200 OK** (likely due to anti-bot measures or asynchronous request handling). The current implementation is too strict since it only considers 200 a successful response and treats any other 2xx status as an error. As a result, the response body is never read and oneboxing fails with an _“error code of 202”_ message:

 ![image](https://global.discourse-cdn.com/meta/original/4X/b/d/f/bdf77e800ac22e93ca0bf2fe0ff9564fdd1c5314.png)

This has a direct, user-visible impact whenever someone pastes an IMDB link into a post.

The `fetch_response` method currently accepts **only HTTP 200** as a successful response. Any other 2xx status, including the **202** , is passed to `response.error!`, causing the fetch to fail before the response body can be processed.

> <https://github.com/discourse/discourse/blob/main/lib/onebox/helpers.rb#L116-L118>

Can we accept the full range of successful HTTP status codes (2xx) instead of only 200?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [July 16, 2026, 9:56am UTC](https://meta.discourse.org/t/fetch-response-rejects-http-202-breaking-imdb-oneboxes/407725/3 "2026-07-16T09:56:01Z")

</div>

Looks like [imdb.com](http://imdb.com) is behind a WAF which prevents scraping (and thus oneboxing), so I’m afraid there’s not much we can do about it, other than improving the message shown to the user

> <https://github.com/discourse/discourse/pull/41764>
>
> Previously, when a site behind a bot-protection service answered a onebox fetch …with a JavaScript challenge — IMDb, for example, currently returns \`202 Accepted\` with an AWS WAF challenge page — the preview showed the baffling "the web server returned an error code of 202", a success code presented as an error with no hint of the actual cause.
> 
> This change detects the documented challenge headers (AWS WAF's \`x-amzn-waf-action\` and Cloudflare's \`cf-mitigated\`) in \`FinalDestination\` and shows a message explaining that the site requires visitors to pass a verification step in a web browser. Accepting 2xx statuses beyond 200 instead would not help: the challenge response carries no OpenGraph data, so the onebox would just come out silently blank.
> 
> Reported in https://meta.discourse.org/t/407725
> 
> \*\*BEFORE\*\*
> 
> \<img width="726" height="605" alt="2026-07-16 @ 09 51 32" src="https://github.com/user-attachments/assets/929b116d-d07a-4aca-a655-6c4b1d0db607" /\>
> 
> 
> \*\*AFTER\*\*
> 
> \<img width="718" height="685" alt="2026-07-16 @ 09 52 10" src="https://github.com/user-attachments/assets/7b555557-6cb4-40ac-a7dc-32bf2515e357" /\>

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [July 28, 2026, 4:43pm UTC](https://meta.discourse.org/t/fetch-response-rejects-http-202-breaking-imdb-oneboxes/407725/5 "2026-07-28T16:43:13Z")

</div>

To close this, here’s what the new message shows in the composer’s preview

 ![2026-07-28 @ 16.42.44](https://global.discourse-cdn.com/meta/original/4X/f/d/2/fd27875297305327adc4f26d96788ed86b0999f9.png)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [July 28, 2026, 4:43pm UTC](https://meta.discourse.org/t/fetch-response-rejects-http-202-breaking-imdb-oneboxes/407725/6 "2026-07-28T16:43:22Z")

</div>


