特定の URL パターンを許可する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
不正なユーザーが API キーを使用して、お客様のドメインからお客様の所有していないサイトにリダイレクトする Dynamic Links を作成することを防ぐには、Dynamic Links がリダイレクトできる URL を指定する必要があります。
許可する URL を指定するには、Firebase コンソールの [Dynamic Links] ページで more_vert > [URL パターンを許可リストに登録] をクリックし、RE2 構文を使用して最大 10 個の正規表現を指定します。Dynamic Links のディープリンク(link
)またはフォールバック リンク(afl
、ifl
、ipfl
、ofl
)として正常に使用できるのは、これらの正規表現のいずれかに一致する URL のみです。URL パターンを指定すると、いずれのパターンにも一致しない URL に対して Dynamic Links が HTTP エラー 400 を返します。
URL パターンはできる限り制限を厳しくする必要があります。次に例を示します。
制限が緩すぎる |
適切な例 |
^https://.*.com/.*$
.com で終わる任意のサイトの任意のページにリダイレクトできます。
|
^https://mybrand\.com/.*$
リダイレクト先は mybrand.com のページに限定されます。
|
^https://play.google.com/.*$
どのアプリの Google Play Store ページにもリダイレクトできます。
|
^https://play\.google\.com/.*id=myapp\.com$
リダイレクト先は、パッケージ名が myapp.com のアプリの Google Play Store ページに限定されます。
|
^https://itunes.apple.com/.*$
itunes.apple.com のどのページにもリダイレクトできます。
|
^https://itunes\.apple\.com/.*id123$
リダイレクト先は、ID が id123 のアプリの App Store ページに限定されます。
|
Dynamic Links のデバッグページを表示し、警告がないことを確認することで、Dynamic Links のディープリンクとフォールバック リンクが URL パターンのいずれかに一致することを確認できます。
https://example.page.link/WXYZ?d=1
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-19 UTC。
[null,null,["最終更新日 2025-08-19 UTC。"],[],[],null,["\u003cbr /\u003e\n\n| **Deprecated:** Firebase Dynamic Links is *deprecated* and should not be adopted in projects that don't already use it. The service will shut down on August 25, 2025. See the [Dynamic Links Deprecation FAQ](/support/dynamic-links-faq) for more information.\n\nTo prevent unauthorized parties from using your API key to create Dynamic Links that\nredirect from your domain to sites you don't own, you should specify the URLs\nyour Dynamic Links can redirect to.\n\nTo specify the allowed URLs, click\nmore_vert **\\\u003e Allowlist URL pattern**\nfrom the Dynamic Links page of the Firebase console, and then specify up to\n10 regular expressions using\n[RE2 syntax](https://github.com/google/re2/wiki/Syntax). Only URLs\nthat match one of these regular expressions can be successfully used as a deep\nlink (`link`) or fallback link (`afl`, `ifl`, `ipfl`, `ofl`) for a Dynamic Links. If\nyou specify URL patterns, any URL that doesn't match one of the patterns will\ncause your Dynamic Links to return HTTP error 400.\n\nYou should make your URL patterns as restrictive as possible. For example:\n\n| Too permissive | Better |\n|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| `^https://.*.com/.*$` Can redirect to any page on any site ending with `.com`. | `^https://mybrand\\.com/.*$` Can redirect only to pages at `mybrand.com`. |\n| `^https://play.google.com/.*$` Can redirect to any app's Google Play Store page. | `^https://play\\.google\\.com/.*id=myapp\\.com$` Can redirect only to Google Play Store pages for the app with the package name `myapp.com`. |\n| `^https://itunes.apple.com/.*$` Can redirect to any page on `itunes.apple.com`. | `^https://itunes\\.apple\\.com/.*id123$` Can redirect only to the App Store page for the app with the ID `id123`. |\n\nYou can make sure a deep link and fallback links for a Dynamic Links match one of\nyour URL patterns by viewing the debug page for Dynamic Links and verifying there are\nno warnings: \n\n```\nhttps://example.page.link/WXYZ?d=1\n```"]]