# 리다이렉트가 있는 경우 링크 변환 방지

**URL:** https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964
**Category:** Feature
**Created:** [5월 13, 2022, 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:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jonathan\_Poyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan_poyer/32/258087_2.png) [@Jonathan\_Poyer](https://meta.discourse.org/u/Jonathan_Poyer)
#### Post date: [5월 13, 2022, 4:06오후 UTC](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964/1 "2022-05-13T16:06:44Z")

</div>

제 이해가 맞다면, Discourse는 markdown-it/linkify-it를 사용하여 제목이 포함된 링크를 제공하기 위해 [GitHub - markdown-it/linkify-it: Links recognition library with full unicode support · GitHub](https://github.com/markdown-it/linkify-it) 라이브러리를 사용하고 있습니다. 예를 들어, 이전 링크는 `GitHub - markdown-it/linkify-it: Links recognition library with full unicode support`라는 제목을 표시합니다.

하지만 다음과 같은 문제가 있습니다. 게시된 일부 링크에 액세스하려면 다른 도구(예: Jira, Google 등)에 인증되어 있어야 합니다. 이 경우 모든 링크(일부 변환된 URL의 경우 블록 포함)가 `Login to support` 또는 `Meet Google Drive – One place for all your files[...]`와 같은 제목으로만 표시되며, 이는 바람직하지 않습니다.

URL을 사전 테스트하여 리디렉션이 있는 경우 해당 URL에 제목을 부여하지 않도록 하는 기능이 이미 존재합니까? 또는 이를 가능하게 하는 컴포넌트/플러그인이 있습니까?

---

<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: [5월 16, 2022, 2:27오전 UTC](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964/2 "2022-05-16T02:27:01Z")

</div>

> [@Jonathan\_Poyer](#):
>
> URL을 사전 테스트하고 리다이렉트가 있는 경우 URL에 제목을 부여하지 않도록 허용하는 기존 기능 또는 컴포넌트/플러그인이 이미 있나요?

네, 여기서는 일반적으로 `blocked onebox domains`(차단된 원박스 도메인) 사이트 설정을 사용합니다.

모든 내부 “로그인 필요” URL을 해당 목록에 추가하세요.

@nat/@codinghorror 님, 여기에 망치(sledghammer) 설정을 추가해야 할지 궁금합니다.

`block onebox on redirect`(리다이렉트 시 원박스 차단) - 이 설정은 리다이렉트가 관여되면 모든 원박스를 완전히 차단할 수 있습니다. 여러 도메인에 걸쳐 이 동작을 무조건적으로 제어하는 매우 간단한 레버를 제공합니다.

---

<div class="post-metadata">

### Author: ![Jonathan\_Poyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan_poyer/32/258087_2.png) [@Jonathan\_Poyer](https://meta.discourse.org/u/Jonathan_Poyer)
#### Post date: [5월 16, 2022, 4:10오전 UTC](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964/3 "2022-05-16T04:10:43Z")

</div>

내부 링크에 대한 힌트를 주셔서 감사합니다.  
`block onebox on redirect`와 같은 더 일반적인 기능이 있다면 매우 감사하겠습니다. 사용자가 게시할 수 있는 전체 링크 목록을 사전에 알 수 없기 때문입니다.

이 기능이 링크화(linkified)되었지만 "onebox"로 업데이트되지 않고 단순히 제목으로만 변환되는 링크에는 작동하지 않는 것 같습니다. (예: 내부 링크 [https://support.sqills.com/browse/SCQI-934가](https://support.sqills.com/browse/SCQI-934%EA%B0%80) `Log in - Sqills Jira`로 변환되지만, 기본 URL은 링크 제목으로 `https://support.sqills.com`만 표시합니다.)

---

<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: [5월 17, 2022, 12:20오전 UTC](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964/4 "2022-05-17T00:20:08Z")

</div>

> [@Jonathan\_Poyer](#):
>
> 링크화(linkified)된 링크 중 "onebox"로 업데이트되지 않고 단순히 제목으로 변환되는 링크에는 작동하지 않는 것 같습니다. (예: 내부 링크 [Log in - Sqills Jira](https://support.sqills.com/browse/SCQI-934)은 `Log in - Sqills Jira`로 변환되지만, 기본 URL만으로는 `https://support.sqills.com`이 링크의 제목으로 표시됩니다.)

여기 분명히 정리해야 할 혼란스러운 버그가 있습니다.

저는 방금 `support.sqills.com`을 차단했고, [https://support.sqills.com/browse/SCQI-934?1](https://support.sqills.com/browse/SCQI-934?1) [https://support.sqills.com/browse/SCQI-934?1의](https://support.sqills.com/browse/SCQI-934?1%EC%9D%98) 경우 의도된 대로 작동하는 것을 확인했습니다. 하지만 안타깝게도 `https://support.sqills.com/browse/SCQI-934`는 서버 측에서 24시간 동안 캐시되며, HTML을 다시 빌드해도 캐시가 무효화되지 않습니다.

이번 주에 이 작은 문제를 해결하여 이에 대한 지원 요청을 줄이겠습니다. 리다이렉트를 차단하는 옵션은 좋은 아이디어로 생각되며, 이 기능을 포함시킬 수 있을지도 모릅니다. `block onebox on cross domain redirect`가 더 나은 표현일 수도 있고, 아니면 너무 세밀한 설정일 수도 있어 확신이 서지 않습니다.

---

<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: [5월 23, 2022, 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에 대해 절대 원박스(onebox)를 생성하지 않습니다. 유일한 예외는 URL이 http이고 해당 URL의 https 버전으로 리디렉션되는 경우입니다. TLS를 지원하는 사이트에서 http 트래픽을 https로 리디렉션하는 것이 매우 일반적이기 때문에, 사용자가 예를 들어 http 링크를 입력하고 사이트가 https로 리디렉션하더라도 원박스가 계속 작동하도록 하기 위해 이렇게 처리합니다.

---

<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: [5월 24, 2022, 10:02오후 UTC](https://meta.discourse.org/t/prevent-to-linkify-when-there-is-a-redirect/226964/10 "2022-05-24T22:02:54Z")

</div>


