如何在AEM Dispatcher篩選規則中指定選取器

✨ 此內容是AI產生的,可能不準確。 產生AI辭彙

本文說明如何在Adobe Experience Manager Dispatcher篩選規則中設定「搜尋」和「子項」等選取器,以適當允許或限制請求。

說明 description

環境

Adobe Experience Manager (所有版本)

症狀

需要透過Dispatcher篩選規則限制或允許使用選取器(例如search或children,例如page.search.html或page.children.json之類的URL)的請求。 目前還不清楚在Dispatcher設定中,是否應在開頭指定選取器,以及如何正確設定這些規則。

範例URL:

  • /content/page.search.html
  • /content/page.children.json

原因

Dispatcher篩選規則會比對URL中不含前導點的選取器部分。 包含圓點會使規則無法如預期般符合。

解決方法 resolution

請依照下列步驟解決問題:

  1. 在Dispatcher篩選規則中,請勿包含前導點(.) 在/selectors屬性中指定選取器時。

  2. 在/selectors regex模式中僅指定選取器名稱(例如search或children)。

  3. 使用類似下列範例的篩選規則:

    code language-none
    /006 {
      /type "deny"
      /path "/content/*"
      /selectors     '(feed|rss|pages|languages|blueprint|infinity|tidy|sysview|docview|query|jcr:content|_jcr_content|search|children|childrenlist|ext|assets|assetsearch|[ 0-9-] +)'
      /extension '(json|xml|html|feed)'
    }
    
  4. 透過使用指定的選取器測試URL,確認篩選規則符合預期的要求。

recommendation-more-help
experience-cloud-kcs-help-kbarticles