Testando o TTL de cache de seu servidor web

  • Post author:
  • Post category:Geral

Uma das formas mais fáceis de evidenciar o tempo de cache do seu servidor web é através do comando Curl. Com uma simples linha de comando
você consegue trazer informações do header do pacote TCP e debugar o seu sistema de cache.

curl -svo /dev/null -H “Fastly-Debug:1” https://www.uol.com.br

Se você quizer saber se os estáticos do site também possuem o mesmo TTL, casos comuns na Akamai para ter para cada tipo de conteúdo estático um tempo de TTL
diferente. Para isto basta informar a URL completa do estático para pegar o tempo do cache:

curl -svo /dev/null -H “Fastly-Debug:1” https://www.uol.com.br/19.9d796653.chunk.css


curl -svo /dev/null -H "Fastly-Debug:1" https://www.natura.com.mx/static/css/19.9d796653.chunk.css
* Trying 92.122.182.59...
* TCP_NODELAY set
* Connected to www.natura.com.mx (92.122.182.59) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [231 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [102 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [6421 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=commercestg.natura.com.br
* start date: Aug 26 01:15:15 2021 GMT
* expire date: Nov 24 01:15:14 2021 GMT
* subjectAltName: host "www.natura.com.mx" matched cert's "www.natura.com.mx"
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7ffc0d009200)
> GET /static/css/19.9d796653.chunk.css HTTP/2
> Host: www.natura.com.mx
> User-Agent: curl/7.64.1
> Accept: */*
> Fastly-Debug:1
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 403
< server: AkamaiGHost
< mime-version: 1.0
< content-type: text/html
< content-length: 323
< expires: Thu, 09 Sep 2021 04:15:06 GMT
< date: Thu, 09 Sep 2021 04:15:06 GMT
< cache-control: 8400
< access-control-max-age: 86400
< access-control-allow-credentials: *
< access-control-allow-headers: *
< access-control-allow-methods: GET,POST,OPTIONS
< access-control-allow-origin: *
<
{ [323 bytes data]
* Connection #0 to host www.natura.com.mx left intact
* Closing connection 0