¿Qué solicitudes AEM caché de Dispatcher?

Descripción

Entorno

AEM Dispatcher 4.3.3

Problema

Este artículo determina por qué Dispatcher AEM no está almacenando en caché la solicitud/respuesta HTTP.

Resolución

La documentación cubre los escenarios más importantes que afectan a la capacidad de caché de las solicitudes y respuestas que pasan por el módulo AEM Dispatcher. No se cubren todas las reglas de caché.

Reglas de solicitud y almacenamiento en caché HTTP

Para que Dispatcher pueda almacenar en caché una solicitud HTTP, debe cumplir las siguientes reglas:

  1. La dirección URL es absoluta (no funciona con . o …), tiene una extensión de archivo y el nombre de archivo de la URL funciona como un archivo en el sistema de archivos.

    Mensajes de registro relacionados:

    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
    

    Ejemplos:

    /content/test not cached
    /content/test.html cached
  2. No tiene barras oblicuas después de la primera extensión de archivo.

    Mensajes de registro relacionados:

    request URL has trailing slash
    

    Ejemplos:

    /content/test.html/ not cached
    /content/test.html/foo.jpg not cached
    /content/test.html cached
  3. Utiliza el método de GET HTTP o HEAD.

    Mensajes de registro relacionados:

    request method is neither GET nor HEAD
    

    Ejemplos:

    HEAD /content/test.html HTTP/1.1 cached
    GET /content/dam/test.jpg HTTP/1.1 not cached
    POST /content/test.html HTTP/1.1 not cached
  4. La solicitud es denegada por /CACHE = /RULES definido en el dispatcher. CUALQUIER CONFIGURACIÓN DE LA GRANJA.
    Mensajes de registro relacionados:

    URI not  in cache rules: %s request URL not in cache rules
    

    Ejemplos:



    <br> Farm has /cache = /rules and a request is received for /content/test.html /cache {  ...  /rules  {   /0001 {   type "deny"   glob "*"   }  } }<br>

    not cached


    <br> Farm has /cache = /rules and a request is received for /content/test.html /cache {  ...  /rules  {   /0001 {   type "allow"   glob "*"   }  } }<br>

    cached
  5. La solicitud HTTP no contiene un encabezado de autorización o contiene el encabezado, pero /ALLOWAUTHORIZED se establece en 1 en la CONFIGURACIÓN FARM.
    Mensajes de registro relacionados:

    request contains authorization
    

    Ejemplos:



    <br> HTTP Request: GET /content/test.html HTTP/1.1 Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l dispatcher.any farm /cache = /allowAuthorized configuration: /cache {  /allowAuthorized “0” }<br>

    not cached
    Solicitud HTTP:

    <br> GET /content/test.html HTTP/1.1<br> Cookie: authorization=YWxhZGRpbjpvcGVuc2VzYW1l<br> <br> dispatcher.any farm /cache = /allowAuthorized configuration:<br> <br> /cache {<br> <br>  /allowAuthorized “0”<br> }<br>

    no almacenado
    Solicitud HTTP:

    <br> GET /content/test.html HTTP/1.1<br> Cookie: login-token=…<br> <br> dispatcher.any farm /cache = /allowAuthorized configuration:<br> <br> /cache {<br> <br>  /allowAuthorized “1”<br> }<br>

    en caché
  6. Hay un parámetro QUERYSTRING en la dirección URL y se permite ignorar el parámetro a través de la CONFIGURACIÓN de FARM /IGNOREURLPARAMS.

    Mensajes de registro relacionados:

    request contains a query string
    

    Ejemplos:

    Solicitud HTTP:

    <br> GET /content/test.html?test=1 HTTP/1.1<br> Farm /cache configuration:<br> <br> /ignoreUrlParams {<br>  /0001 { /type “allow” /glob “*” }<br> }<br>

    en caché
    Solicitud HTTP:

    <br> GET /content/test.html?test=1 HTTP/1.1<br> Farm /cache configuration:<br> <br> /ignoreUrlParams {<br>  /0001 { /type “deny” /glob “*” } <br> <br>  /0001 { /type “allow” /glob “test” }<br> }<br>

    en caché
    Solicitud HTTP:

    <br> GET /content/test.html?test=1 HTTP/1.1<br> dispatcher.any farm /cache = /allowAuthorized configuration:<br> <br> /ignoreUrlParams {<br> <br>  /0001 { /type “deny” /glob “*” } <br> <br>  /0001 { /type “allow” /glob “q” }<br> }<br>

    no almacenado

Reglas de respuesta y almacenamiento en caché HTTP:

La respuesta HTTP devuelta por AEM se puede almacenar en caché si se cumplen los siguientes criterios:

  1. Dispatcher puede enviar y recibir una respuesta de 200 OK de uno de los "RENDERS" definidos.

    Nota: Si no /timeout está configurado en /renders o está establecido en 0, entonces esperaría para siempre una conexión con la instancia de AEM aunque la instancia esté baja.

    Mensajes de registro relacionados:

    Unable to send request to remote server. Unable to receive response from remote server. Remote server returned: %s No backend available.
    

    Ejemplos:

    Solicitud HTTP:

    200 OK
    en caché
    Solicitud HTTP:

    404 Página no encontrada
    no almacenado
  2. Ninguno de estos encabezados de respuesta está presente en la respuesta:

    • Dispatcher: no-cache
    • Cache-control: no-cache
    • Pragma: no-cache

    Mensajes de registro relacionados:

    Backend forbids caching: %s, sent: %s" response contains no_cache
    

    Ejemplos:

    Respuesta HTTP:

    200 OK

    Dispatcher: no-cache
    no almacenado
    Respuesta HTTP:

    200 OK

    Control de caché: no-cache
    no almacenado
    Respuesta HTTP:

    200 OK

    Pragma: no-cache
    no almacenado
    Respuesta HTTP:

    200 OK
    en caché
  3. El valor de longitud de contenido es bueno que CERO BYTES.

    Mensajes de registro relacionados:

    response content length is zero
    

    Ejemplos:

    Respuesta HTTP:

    200 OK

    Content-Length: 0
    no almacenado
    Respuesta HTTP:

    200 OK

    Content-Length: 3120
    en caché

En esta página