AEM Dispatcherでキャッシュするリクエストはどれですか?
この記事では、AEM DispatcherがキャッシュしないHTTP リクエスト/レスポンスの理由と理由を説明します。
説明 description
環境
AEM Dispatcher 4.3.3
問題
このドキュメントでは、AEM Dispatcher モジュールを経由するリクエストとレスポンスのキャッシュ能力に影響を与える最も重要なシナリオについて説明します。 すべてのキャッシュルールはカバーされていません。
解決策 resolution
HTTP リクエストとキャッシュ ルール
DispatcherでHTTP リクエストをキャッシュするには、次のルールに従う必要があります。
-
URLは絶対です(で動作しません)。 または…)にはファイル拡張子があり、URLのファイル名はファイルシステム上のファイルとして機能します。
関連するログメッセージ :
code language-none URI not canonical: %s. Unable to map URI to file: %s. cache file path too long temporary file path too long request URL has no extension例:
table 0-row-2 1-row-2 /content/testnot cached/content/test.htmlcached -
最初のファイル拡張子の後にスラッシュはありません。
関連するログメッセージ :
code language-none request URL has trailing slash例:
table 0-row-2 1-row-2 2-row-2 /content/test.html/not cached/content/test.html/foo.jpgnot cached/content/test.htmlcached -
HTTP GET メソッドまたはHEAD メソッドを使用します。
関連するログメッセージ :
code language-none request method is neither GET nor HEAD例:
table 0-row-2 1-row-2 2-row-2 HEAD /content/test.html HTTP/1.1cachedGET /content/dam/test.jpg HTTP/1.1not cachedPOST /content/test.html HTTP/1.1not cached -
リクエストは、Dispatcherで定義された/CACHE =
>/RULESによって拒否されます。 任意のファーム設定。関連するログメッセージ :
code language-none URI not in cache rules: %s request URL not in cache rules例:
a. キャッシュなし
code language-none Farm has /cache => /rules and a request is received for /content/test.html /cache { ... /rules { /0001 { type "deny" glob "*" } } }b. キャッシュ
code language-none Farm has /cache => /rules and a request is received for /content/test.html /cache { ... /rules { /0001 { type "allow" glob "*" } } } -
HTTP リクエストに認証ヘッダーが含まれていないか、ヘッダーが含まれていますが、/ALLOWAUTHORIZEDはファーム設定で1に設定されています。
関連するログメッセージ :
code language-none request contains authorization例:
a. キャッシュなし
code language-none HTTP Request: GET /content/test.html HTTP/1.1 Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l dispatcher.any farm /cache => /allowAuthorized configuration: /cache { /allowAuthorized “0” }b. キャッシュ
code language-none HTTP Request: GET /content/test.html HTTP/1.1 Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l dispatcher.any farm /cache => /allowAuthorized configuration: /cache { /allowAuthorized “1” } -
HTTP リクエストには、cookie ヘッダーにログイントークンまたは認証Cookieが含まれているか、これらのCookieのいずれか(または両方)が含まれており、/ALLOWAUTHORIZEDはファーム設定で1に設定されています。
関連するログメッセージ :
code language-none request contains authorization例:
a. キャッシュなし
code language-none HTTP Request: GET /content/test.html HTTP/1.1 Cookie: login-token=... dispatcher.any farm /cache = /allowAuthorized configuration: /cache { /allowAuthorized “0” }code language-none HTTP Request: GET /content/test.html HTTP/1.1 Cookie: authorization= YWxhZGRpbjpvcGVuc2VzYW1l dispatcher.any farm /cache = /allowAuthorized configuration: /cache { /allowAuthorized “0” }b. キャッシュ
code language-none HTTP Request: GET /content/test.html HTTP/1.1 Cookie: login-token=... dispatcher.any farm /cache => /allowAuthorized configuration: /cache { /allowAuthorized “1” } -
URLにQUERYSTRING パラメーターがあり、パラメーターはFARMの/IGNOREURLPARAMS CONFIGURATIONを介して無視できます。
関連するログメッセージ :
code language-none request contains a query string例:
a. キャッシュ
code language-none HTTP Request: GET /content/test.html?test=1 HTTP/1.1 Farm /cache configuration: /ignoreUrlParams { /0001 { /type “allow” /glob “*” } }code language-none HTTP Request: GET /content/test.html?test=1 HTTP/1.1 Farm /cache configuration: /ignoreUrlParams { /0001 { /type “deny” /glob “*” } /0001 { /type “allow” /glob “test” } }b. キャッシュなし
code language-none HTTP Request: GET /content/test.html?test=1 HTTP/1.1 dispatcher.any farm /cache = /allowAuthorized configuration: /ignoreUrlParams { /0001 { /type “deny” /glob “*” } /0001 { /type “allow” /glob “q” } }
HTTP応答とキャッシュ ルール:
次の条件を満たす場合、AEMから返されるHTTP レスポンスはキャッシュ可能です。
-
Dispatcherは、定義された「RENDERS」のいずれかから200 OK応答を送受信できます。
注意: /rendersで/timeoutが設定されていない場合、または0に設定されている場合、インスタンスがダウンしていても、AEM インスタンスへの接続を永遠に待つことになります。
関連するログメッセージ :
code language-none Unable to send request to remote server. Unable to receive response from remote server. Remote server returned: %s No backend available.例:
table 0-row-2 1-row-2 HTTP リクエスト:
200 OKキャッシュ HTTP リクエスト:
404 ページが見つかりませんキャッシュなし -
次の応答ヘッダーはいずれも応答に存在しません。
Dispatcher: no-cacheCache-control: no-cachePragma: no-cache
関連するログメッセージ :
code language-none Backend forbids caching: %s, sent: %s" response contains no_cache例:
table 0-row-2 1-row-2 2-row-2 3-row-2 HTTP Response:
200 OK
Dispatcher: no-cacheキャッシュなし HTTP応答:
200 OK
キャッシュ制御:キャッシュなしキャッシュなし HTTP応答:
200 OK
Pragma: no-cacheキャッシュなし HTTP応答:
200 OKキャッシュ -
Content-lengthの値が0 バイトを超えています。 関連するログメッセージ :
code language-none response content length is zero例:
table 0-row-2 1-row-2 HTTP応答:
200 OK
コンテンツ長:0キャッシュなし HTTP応答:
200 OK
コンテンツ長:3120キャッシュ