# "blocked onebox domains" setting not respected

**URL:** https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479
**Category:** Bug
**Created:** [February 16, 2022, 9:35pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479 "2022-02-16T21:35:05Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![dschaper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dschaper/32/209535_2.png) [@dschaper](https://meta.discourse.org/u/dschaper)
#### Post date: [February 16, 2022, 9:35pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/1 "2022-02-16T21:35:05Z")

</div>

`blocked onebox domains` are ignored in 2.9.0beta2 (c6265eec6b).

We have:

 ![Screenshot 2022-02-16 133150](https://global.discourse-cdn.com/meta/original/3X/7/4/74d22cd4af6b1b14661d0b81c2d7b02049637293.png)

Those domains are behind OAuth walls and the onebox is trying to preview the domains and getting the OAuth login URL instead.

 ![Screenshot 2022-02-16 133438](https://global.discourse-cdn.com/meta/original/3X/1/8/184281fa4365f67a86006cecad420c524e419be2.png)

---

<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: [February 16, 2022, 11:01pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/2 "2022-02-16T23:01:11Z")

</div>

That setting only takes effect on the server — your browser will still attempt to do a onebox for the preview.

I can see how this might be unexpected.

If you submit the post, does it show the onebox after the server renders it, or does it show the bare URL as you expect?

---

<div class="post-metadata">

### Author: ![dschaper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dschaper/32/209535_2.png) [@dschaper](https://meta.discourse.org/u/dschaper)
#### Post date: [February 17, 2022, 12:08am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/3 "2022-02-17T00:08:44Z")

</div>

It shows as a onebox when the comment is posted:

 ![Screenshot 2022-02-16 160708](https://global.discourse-cdn.com/meta/original/3X/9/f/9fc638edadcb5d2a2fb924fa3e139072412f26a4.png)

 ![Screenshot 2022-02-16 160730](https://global.discourse-cdn.com/meta/original/3X/8/9/891a42e8e098c12eebe3b72896e385a8e9906724.png)

---

<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: [February 17, 2022, 12:14am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/4 "2022-02-17T00:14:54Z")

</div>

Yes, this doesn’t seem to be working properly… 😕

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [February 17, 2022, 1:09am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/8 "2022-02-17T01:09:53Z")

</div>

Can you try adding “[auth.pi-hole.net](http://auth.pi-hole.net)” in your blocked onebox domains setting?

We’ve made this setting such that [it follows redirects](https://github.com/discourse/discourse/pull/15689) but only blocks the specified domain if it’s the final destination.

---

<div class="post-metadata">

### Author: ![dschaper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dschaper/32/209535_2.png) [@dschaper](https://meta.discourse.org/u/dschaper)
#### Post date: [February 17, 2022, 1:15am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/9 "2022-02-17T01:15:44Z")

</div>

Just tried and it still oneboxes it. I think because the [auth.pi-hole.net](http://auth.pi-hole.net) endpoint is a uri-redirect from the OAuth endpoint on [github.com](http://github.com). And we’d prefer not to block [github.com](http://github.com) from oneboxing.

Let me check and see if blocking github does anything…No, blocking [github.com](http://github.com) doesn’t preven oneboxing either. Is there a cache that onebox may be using that needs to be cleared so a new lookup is done for `tricorder`?

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [February 17, 2022, 1:55am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/10 "2022-02-17T01:55:17Z")

</div>

> [@dschaper](#):
>
> we’d prefer not to block [github.com](http://github.com) from oneboxing

Yes I can understand why.

> [@dschaper](#):
>
> Is there a cache

There’s [a cache for one day](https://github.com/discourse/discourse/blob/a7d43cf1ec18fd7278926cc156529e3fefb721ab/lib/oneboxer.rb#L395) for fetched onebox URLs, so rebaking the post manually (`post.rebake!`) after one day would prevent the oneboxing with [github.com](http://github.com) blocked.

* * *

We have some work backlogged to be smarter about auth redirects, but that’s scoped to auth for Discourse forums only. I’m thinking perhaps expanding the setting to also allow subdirectories would help us with this case for github: [https://github.com/login/oauth/authorize](https://github.com/login/oauth/authorize) … Will discuss internally about this.

It’s probably also good to have the hint text be specific on what is actually blocked, perhaps an additional: “Onebox will follow redirects and block only if the final destination matches this setting”.

---

<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: [February 17, 2022, 2:27am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/11 "2022-02-17T02:27:07Z")

</div>

Wild idea… should we support:

`cache-control: no-store`

> **[Cache-Control header - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)**
>
> The HTTP Cache-Control header holds directives (instructions) in both requests and responses that control caching in browsers and shared caches (e.g., Proxies, CDNs).

> The `no-store` response directive indicates that any caches of any kind (private or shared) should not store this response.

GitHub is specifically saying .. please … don’t store me …

Maybe onebox should respect it … and not store it.

We could always make this an experimental setting to start and see what impact it has.

The preview would have to explain why we are not oneboxing.

* * *

Note… we do use `no-store` in quite a few places, but I think we redirect in those cases, yet there is this slight complexity.

> <https://github.com/discourse/discourse/blob/a0c65e91d91dc23f9fd99c9be1b4aa9a1c068782/spec/requests/topics_controller_spec.rb#L1868-L1874>

---

<div class="post-metadata">

### Author: ![dschaper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dschaper/32/209535_2.png) [@dschaper](https://meta.discourse.org/u/dschaper)
#### Post date: [February 17, 2022, 8:15pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/12 "2022-02-17T20:15:55Z")

</div>

We do link to a lot of PRs and Issues from our various repositories and having those oneboxed with the previews helps newer users see what the topic is about without having to get in to GitHub.

---

<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: [February 17, 2022, 8:56pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/13 "2022-02-17T20:56:18Z")

</div>

Yes totally get that, we are working on a solution, a day later I think looking at the no store header may be the best way forward

---

<div class="post-metadata">

### Author: ![dschaper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dschaper/32/209535_2.png) [@dschaper](https://meta.discourse.org/u/dschaper)
#### Post date: [February 28, 2022, 7:57pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/14 "2022-02-28T19:57:27Z")

</div>

Sorry to bump this but it’s really affecting our support site. People post links to the tricorder URL that are troubleshooting logs for credentialed staff to look over. We get a number of these posts a day and we have to manually go in and change the URL to a non-link for now.

Any ideas on a timeframe to resolution or is it “soon™” 🙂

---

<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: [February 28, 2022, 8:21pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/15 "2022-02-28T20:21:37Z")

</div>

We will get this sorted, I would say some time in the next 4 weeks or so

---

<div class="post-metadata">

### Author: ![GreenOWL](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@GreenOWL](https://meta.discourse.org/u/GreenOWL)
#### Post date: [March 10, 2022, 3:21pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/19 "2022-03-10T15:21:19Z")

</div>

How to do it in Discourse Docker? 🥺

---

<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: [March 11, 2022, 12:22am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/20 "2022-03-11T00:22:21Z")

</div>

I recommend waiting on our fix to land, we have a PR in progress:

[https://github.com/discourse/discourse/pull/16150](https://github.com/discourse/discourse/pull/16150)

It amends the behavior so:

1. We do the blocklist checking on every hop in a redirect chain
2. We introduce a new feature so any site can opt out of oneboxing by setting a customer header

This will resolve @dschaper issue and give us more flexibility in future.

Unfortunately going with `no store` would cast a way too wide net and catch too many false positives.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [March 11, 2022, 6:50am UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/21 "2022-03-11T06:50:43Z")

</div>

The PR has been merged and it’s in the `tests-passed` branch. Can you upgrade @dschaper and see if it fixes the problem? URLs with the `tricorder.pi-hole.net` domain should no longer onebox on your site.

---

<div class="post-metadata">

### Author: ![dschaper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dschaper/32/209535_2.png) [@dschaper](https://meta.discourse.org/u/dschaper)
#### Post date: [March 14, 2022, 10:15pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/22 "2022-03-14T22:15:26Z")

</div>

Looks all good here!

Thanks for the fix everyone.

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [March 14, 2022, 10:52pm UTC](https://meta.discourse.org/t/blocked-onebox-domains-setting-not-respected/218479/23 "2022-03-14T22:52:18Z")

</div>


