Onebox リダイレクトにより、ログイン限定コンテンツへのリンクが防止されます

Onebox follows redirects, which is usually a good thing, I guess.

This becomes a problem, however, when you share a link to a page requiring sign-in that simply redirects to a sign-in page when an anonymous user visits it.

For example, if I want to share my top secret project hosted at https://dgit.cs.uni-saarland.de/fefrei/my-top-secret-project/ in the internal category of our Discourse instance, this is what I get by default:

Note that all links in the Onebox go to https://dgit.cs.uni-saarland.de/users/sign_in, which is not helpful.

Of course, as a post author, I can prevent that by using any alternative markup that prevents the Onebox (which can’t show relevant content anyways); but if some other user does this and doesn’t notice, it’s pretty hard to retrieve the actual link.
As staff, I can edit the post to get the raw markup, but as a non-staff user, I think the only feasible workaround is to remember the magic /raw/ URL scheme.

Why does the Onebox link to the final location, not the original URL? Can we do something to improve this?

「いいね!」 2

Why wouldn’t it link to the final location?

I typed https://dgit.cs.uni-saarland.de/fefrei/my-top-secret-project/, why should it link somewhere else?

When I’m redirected to the sign in page, this is fine, because I’m in a session – I can actually log in, and will be redirected back to the target URL.
When Discourse follows the redirect, forgets the original URL and just outputs the sign in URL, the reader has no (easy) way to get to the URL the author linked to.

Well, the workaround is to enter the link with angle brackets. It’s normal and expected to follow link redirects to the final destination.

I know that’s the current behavior, and already mentioned the workaround above:

I stumbled about this because another user fell for this trap, and I had to fish the actual link out of the raw view.

I’m not saying that this is terribad and needs to be fixed now or else; I’m just reporting that I find it sad that a user who simply pasted a link into his post got a Onebox that obfuscates the link in a way that makes it impossible for the average user to understand where to go. (There’s a reason I posted this in feature.)

「いいね!」 1

今日はこの挙動に出くわし、UX の変更を支持します。

最終的な場所にリンクしたくないケースは、リンクを共有する相手がそのサイトに認証されている、または認証できることを期待している場合です。

また、見た目の問題もあります。別のコミュニティで Discourse のスレッドへのリンクを投稿したところ、そのリンクがサインインページを指すように変更されていました。人々は、意図的にサインインページにリンクするのは奇妙だとして、私が間違ったリンクを投稿したのかと尋ねてきました。結局のところ、投稿者が意図した内容を改変することになります。

回避策は有効ですが、最善ではありません。投稿者とリンクをクリックするユーザーの両方にとって悪い UX を避けるためには、より賢明なデフォルト設定が必要です。

「いいね!」 3

これに対処する方法として、文字列マッチングで「サインイン」をハードコードする以外に思いつきません。しかし、その解決策は本当に好みません。非常に脆弱になってしまうからです。

なぜそんなものが必要になるのでしょうか?

混乱の元になっているなら申し訳ありませんが、もしかすると私の最初の要望が不明瞭だったかもしれません。以下に明確にします:

ユーザーが https://example.org/a にリンクしたと仮定しますが、この URL はログインしていない限り https://example.org/login にリダイレクトされます。現在の動作は以下の通りです:

  1. Discourse が https://example.org/a をリクエストし、リダイレクトに従います。
  2. Discourse が https://example.org/login をリクエストし、タイトルや画像などを取得します。
  3. Discourse は https://example.org/login から取得した情報を含む Onebox を表示しますが、そのリンク先は https://example.org/login になっています。生成された Onebox には https://example.org/a へのリンクはどこにもありません。

問題視しているのは太字の部分だけです。リンクに従ってそこから情報を取得するのは結構ですが、Onebox は常に私が入力した URL へリンクするべきです。

これは Onebox がサインインページの情報(他に何を表示すべき?)を表示することに関するものではなく、Onebox の生成によって元のリンク先が完全に隠されてしまうことに関するものです。

これが実装されれば、私の元の投稿にある Onebox の見た目は同じままですが、リンク先は https://dgit.cs.uni-saarland.de/fefrei/my-top-secret-project/ になります。

これでより理解しやすくなりましたか?:slight_smile:

「いいね!」 3

そうでもありません。インターネット上のほとんどの「リンク」は、今や何らかのリダイレクトになっているからです。

しかし、それに何の問題があるのでしょうか?ユーザーがリンクをクリックした場合も、リダイレクトはリンクがワンボックス化されていない場合と同じように機能します。

「いいね!」 1

はい。

リダイレクト先ではなく、リンクされた対象へ直接リンクする方が理にかなっています。この問題が解決し、私の知る限り何も壊れることはありません。

すべてがリダイレクトする場合、元のリンクを維持する方がなお一層妥当です。

「いいね!」 3

私は同意しません。あなたは、一般的なリンク短縮サービスをクリックしたという事実ではなく、最終的な宛先を知りたいはずです。私はここで正反対の見解を持っています。

ねえ、link.is/ghwk4fe3 をクリックしようとしているよ

と示すのは、

ねえ、example.com/funny-article をクリックしようとしているよ

と示すよりも、はるかに役に立たないものです。

「いいね!」 1

しかし、ここではワンボックスについて話しています。ワンボックス以外では、そもそもこれを行いません。
また、実際には最終的な URL を表示することに反対しません。ただし、ログインが必要な状況では、元の URL へのリンクを削除するとリンクが壊れてしまいます :frowning:

「いいね!」 5

あなたの意見には全く反対ではありませんが、ログインページの例を使って実際に試してみてください。メタに非公開カテゴリの例はありますか?もし一つあったとして、私がこの返信にリンクを投稿したとしましょう。ワンボックスの仕組み上、そのリンクがどこへ向かうのか、あるいはそこにたどり着けるのかを知ることはできなくなります。

ワンボックスが最終ページのコンテンツを表示することに私は問題ありませんが、元の URL を保持しないと、このシナリオでリダイレクトが意図通りに機能する可能性がなくなります。それに、元のリンクに含まれるアトリビューションタグも失われてしまいます。

「いいね!」 3