Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
Static file on static folder not cached

enter image description here

I'm using sveltekit and trying to load static assets like css/js on my localhost, but it didn't cached like disk cache or memory cache, how can I resolve this? it should be cached by default right?

...
<link rel="stylesheet" href="/assets/css/open-iconic-bootstrap.min.css">
...

I already deploy it to vercel and still doesn't cached, I need help.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

This is already using the cache, however it is being revalidated every time.

You can see from the response 304 (Not Modified) and the transmitted size (113 bytes) that the resource is not re-transmitted.

How caching of static files is handled in the end depends on the adapter being used and the deployment environment. E.g. with Node the mechanism for setting additional caching headers would be different from the mechanism for an Nginx file server.

For Vercel, you might want to read its article on caching. However, revalidating every time might not be a bad idea, that way you will not get stale data at least.

about 4 years ago · Juan Pablo Isaza Relatório

0

For Vercel, I create another configuration by creating vercel.json in my root folder :

{
  "headers": [
    {
      "source": "/:path*",
      "headers" : [
        {
          "key" : "Cache-Control",
          "value" : "max-age=2592000, s-maxage=10"
        }
      ]
    }
  ]
}

https://vercel.com/docs/project-configuration#project-configuration/headers

"source": "/:path*",

means wildcard that matches all routes.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda