# ブロックされたドメインのサブドメインをoneboxに許可する

**URL:** <https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737>\
**Category:** Support\
**Tags:** onebox\
**Created:** [2023 年 6 月 17 日午後 1:59 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737 "2023-06-17T13:59:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)\
**Post date:** [2023 年 6 月 17 日午後 1:59 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/1 "2023-06-17T13:59:24Z")

</div>

私が手伝っているサイトで、特定のサイトがワンボックス化に失敗し（大きな空白スペースになる）、最近見つかりました。そのドメインをワンボックス化からブロックすることもできましたが、そのサイトのサブドメインでホストされているフォーラムのワンボックス化が壊れてしまいます。トップドメインのワンボックス化を許可せずに、サブドメインのワンボックス化を許可することは可能でしょうか？

---

<div class="post-metadata">

**Author:** ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)\
**Post date:** [2023 年 6 月 18 日午後 9:33 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/2 "2023-06-18T21:33:07Z")

</div>

例えば、このメインサイトのワンボックスは失敗します（`https://replit.com/@Firepup650/Yeehaw`）：  
[https://replit.com/@Firepup650/Yeehaw](https://replit.com/@Firepup650/Yeehaw)  
しかし、サブドメイン（Discourse）は問題ありません（`https://ask.replit.com/t/my-intro-i-guess/20705`）：  
[https://ask.replit.com/t/my-intro-i-guess/20705](https://ask.replit.com/t/my-intro-i-guess/20705)

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2023 年 6 月 19 日午後 8:18 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/3 "2023-06-19T20:18:38Z")

</div>

残念ながら、このトピックによるとそれは不可能だと思います。

> [@How can I block specific links from oneboxing?](https://meta.discourse.org/t/how-can-i-block-specific-links-from-oneboxing/252579):
>
> I’m trying to preserve the oneboxing of the homepage of a specific domain, but prevent the oneboxing of any thing more that that. i.e. [mydomainofinterest.com](http://mydomainofinterest.com) makes a onebox [mydomainofinterest.com/anything](http://mydomainofinterest.com/anything) does not Is this achievable? I can only seem to block an entire domain - which would be fine if I could get the homepage of that domain to still make a nice onebox.

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [2023 年 6 月 19 日午後 8:50 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/4 "2023-06-19T20:50:59Z")

</div>

リンクで巨大な空白が生じているようです。プレビューで、大きな「Replit」ロゴ画像を表示しようとしていることに気づきました。これらのタイプのページで使用されている画像がワンボックスを破損させているのではないでしょうか？それを整理することで、きれいに解決できるかもしれません。

---

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023 年 7 月 3 日午後 12:06 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/5 "2023-07-03T12:06:07Z")

</div>

Replit oneboxes には特定のスクリプトがあります。

> <https://github.com/discourse/discourse/blob/7a204e754c17d1e8229bb782c17f450813c201ec/lib/onebox/engine/replit_onebox.rb>

Replit リンクを貼り付けると、コンポーザーには期待どおりの結果が表示されます。

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/e/2/9e218acadeb34280c61e4bda58c9fc1cb14d19ac.png)

投稿が処理されると、リンクは空の iframe に変換されます。

```html
<iframe width="695" height="521" frameborder="0" data-unsanitized-src="https://replit.com/@Firepup650/Yeehaw?embed=true" seamless="seamless" sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation">
#document
  <html>
    <head></head>
    <body></body>
  </html>
</iframe>

```

問題が Replit 側にあるのか、onebox スクリプト側にあるのかわかりません。コーダーではありませんが、スクリプト側だと思います 🙂  
リンクには適切な opengraph タグがあります。[https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Freplit.com%2F%40Firepup650%2FYeehaw](https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Freplit.com%2F%40Firepup650%2FYeehaw)

---

<div class="post-metadata">

**Author:** ![anon44628144](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@anon44628144](https://meta.discourse.org/u/anon44628144)\
**Post date:** [2023 年 10 月 13 日午後 7:32 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/6 "2023-10-13T19:32:20Z")

</div>

Discourse が `replit.com` をワンボックスせず、`ask.replit.com` をワンボックスするように設定したのですが、なぜか一度しか機能しませんでした。その後、両方のドメインでのワンボックスがすべてブロックされてしまいました。奇妙です。

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/b/6/eb6bb6541be3668e7a355be7004c56201e0e054f.png)  
_Firepup と同じフォーラムを運営しています_

---

<div class="post-metadata">

**Author:** ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)\
**Post date:** [2023 年 10 月 13 日午後 7:36 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/7 "2023-10-13T19:36:31Z")

</div>

Replit iframe を明示的に許可した後、次の iframe コード（@Canapin が投稿したものと似ています）は正常に動作します。

```plaintext
<iframe frameborder="0" width="500px" height="500px" src="https://replit.com/@Firepup650/Yeehaw?embed=true"></iframe>

```

---

<div class="post-metadata">

**Author:** ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)\
**Post date:** [2023 年 10 月 13 日午後 8:48 UTC](https://meta.discourse.org/t/allow-sub-domains-from-blocked-domain-to-onebox/268737/8 "2023-10-13T20:48:47Z")

</div>

> [@Canapin](#):
>
> `data-unsanitized-src`

手動テストにより、iframeのこの特定の部分が問題であることが確認されました。これを単なる`src`に変更すると、期待どおりに機能します（[このトピック](https://amcforum.wiki/t/3033/3)の3番目の投稿を参照）。
