# リダイレクトがある場合にリンク化を防ぐ

**URL:** <https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964>\
**Category:** Feature\
**Created:** [2022 年 5 月 13 日午後 4:06 UTC](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964 "2022-05-13T16:06:43Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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:** [2022 年 5 月 23 日午前 5:54 UTC](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964/9 "2022-05-23T05:54:25Z")

</div>

> [@sam](#):
>
> サーバーサイドで24時間キャッシュされ、HTMLの再構築はキャッシュを破っていません。

これは以下で修正されました。

> <https://github.com/discourse/discourse/commit/eddb8891c410c9f552232c5514c8e0439f5e928b>
>
> Meta topic: https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redi…rect/226964/4?u=osama.

これで、投稿が再構築されると、投稿内のすべてのリンクのキャッシュエントリが、再構築を行う前に削除されます。

また、`block_onebox_on_redirect`サイト設定を追加するためのPRは次のとおりです。

> <https://github.com/discourse/discourse/pull/16881>
>
> Meta topic: https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redi…rect/226964/2?u=osama.
> 
> This PR adds a new site setting \`block\_onebox\_on\_redirect\` (default off) for blocking oneboxes (full and inline) of URLs that redirect. Note that an initial http → https redirect is still allowed if the redirect location is identical to the source (minus the scheme of course). For example, if a user includes a link to \`http://example.com/page\` and the link resolves to \`https://example.com/page\`, then the link will onebox (assuming it can be oneboxed) even if the setting is enabled. The reason for this is a user may type out a URL (i.e. the URL is short and memorizable) with http and since a lot of sites support TLS with http traffic automatically redirected to https, so we should still allow the URL to onebox.

`block_onebox_on_redirect`が有効になっている場合、DiscourseはリダイレクトするURLをワンボックス化しません。唯一の例外は、URLがhttpで、URLのhttpsバージョンにリダイレクトする場合です。これは、TLSをサポートするサイトがhttpトラフィックをhttpsにリダイレクトすることが非常に一般的であるため、ユーザーがhttpでリンクを入力し、サイトがhttpsにリダイレクトする場合でもワンボックスが機能するようにするためです。

---

_[View the full topic](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964)._
