Quali richieste AEM la cache del Dispatcher?

Descrizione

Ambiente

AEM Dispatcher 4.3.3

Problema

Questo articolo determina il motivo per cui la richiesta/risposta HTTP non viene memorizzata nella cache da AEM Dispatcher.

Risoluzione

La documentazione descrive gli scenari più importanti che influiscono sulla cache-ability delle richieste e delle risposte che passano attraverso il modulo AEM Dispatcher. Tutte le regole della cache non sono coperte.

Regole di richiesta e memorizzazione in cache HTTP

Affinché una richiesta HTTP possa essere memorizzata in cache dal dispatcher, deve rispettare le seguenti regole:

  1. L’URL è assoluto (non funziona con . o …), ha un'estensione di file e il nome del file nell'URL funziona come file sul file system.

    Messaggi di registro correlati:

    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
    

    Esempi:

    /content/test not cached
    /content/test.html cached
  2. Non ha barre dopo la prima estensione di file.

    Messaggi di registro correlati:

    request URL has trailing slash
    

    Esempi:

    /content/test.html/ not cached
    /content/test.html/foo.jpg not cached
    /content/test.html cached
  3. Utilizza il metodo HTTP GET o HEAD.

    Messaggi di registro correlati:

    request method is neither GET nor HEAD
    

    Esempi:

    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 richiesta è negata da /CACHE = /Rules definita nel dispatcher. QUALSIASI CONFIGURAZIONE DI FARM.

    Messaggi di registro correlati:

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

    Esempi:

    Farm has /cache = /rules e viene ricevuta una richiesta per /content/test.html

    /cache

    {

      …

      /rules

      {

        /0001 {

          digitare "deny"

          glob "*"

          }

      }

    }
    non memorizzato nella cache
    Farm has /cache = /rules e viene ricevuta una richiesta per /content/test.html

    /cache

    {

      …

      /rules

      {

        /0001 {

          digitare "allow"

          glob "*"

          }

      }

    }
    memorizzato in cache
  5. La richiesta HTTP non contiene un'intestazione di autorizzazione o contiene l'intestazione ma /ALLOWAUTHORIZED è impostato su 1 nella CONFIGURAZIONE FARM.

    Messaggi di registro correlati:

    request contains authorization
    

    Esempi:



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

    not cached


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

    cached
  6. La richiesta HTTP contiene il login-token o il cookie di autorizzazione nell'intestazione del cookie, oppure contiene (o entrambi) di questi cookie e /ALLOWAUTHORIZED è impostato su 1 nella CONFIGURAZIONE FARM.

    Messaggi di registro correlati:

    request contains authorization
    

    Esempi:



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

    not cached


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

    not cached


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

    cached
  7. Nell’URL è presente un parametro QUERYSTRING e il parametro può essere ignorato tramite la CONFIGURAZIONE /IGNOREURLPARAMS DI FARM.

    Messaggi di registro correlati:

    request contains a query string
    

    Esempi:

    Richiesta 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>

    memorizzato in cache
    Richiesta 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>

    memorizzato in cache
    Richiesta 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>

    non memorizzato nella cache

Regole di risposta HTTP e memorizzazione in cache:

La risposta HTTP restituita da AEM è memorizzabile in cache se sono soddisfatti i seguenti criteri:

  1. Il dispatcher è in grado di inviare e ricevere una risposta di 200 OK da uno dei "RENDERS" definiti.

    Nota: Se no /timeout è impostato su /renders o su 0, quindi aspetterebbe per sempre una connessione all'istanza AEM anche se l'istanza è inattiva.
    Messaggi di registro correlati:

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

    Esempi:

    Richiesta HTTP:

    200 OK
    memorizzato in cache
    Richiesta HTTP:

    404 Pagina non trovata
    non memorizzato nella cache
  2. Nessuna di queste intestazioni di risposta è presente nella risposta:

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

    Messaggi di registro correlati:

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

    Esempi:

    Risposta HTTP:

    200 OK

    Dispatcher: no-cache
    non memorizzato nella cache
    Risposta HTTP:

    200 OK

    Controllo cache: no-cache
    non memorizzato nella cache
    Risposta HTTP:

    200 OK

    Pragma: no-cache
    non memorizzato nella cache
    Risposta HTTP:

    200 OK
    memorizzato in cache
  3. Il valore della lunghezza del contenuto è maggiore di ZERO BYTES.
    Messaggi di registro correlati:

    response content length is zero
    

    Esempi:

    Risposta HTTP:

    200 OK

    Lunghezza del contenuto: 0
    non memorizzato nella cache
    Risposta HTTP:

    200 OK

    Lunghezza del contenuto: 3120
    memorizzato in cache

In questa pagina