Problem with client cache in Angular 17.1

Discussão em 'Angular' iniciado por Igor Silva, Novembro 25, 2024.

  1. Igor Silva

    Igor Silva Guest

    I have a cache problem in Angular 17.1, all my files are hashed, and yet the client browser does not receive the update. There are users with 4 days of cache and the versions I upload have no effect on some devices, around 15% of devices do not receive the corrected files, Below are the solutions I did and didn't have any results, is there any different solution that can be done?

    1 - I set Hash in Angular Json:

    "outputHashing": "all",


    2 - I set it to nginx.config so that it deletes and redownloads all files

    location ~* \.(js|css|html|woff|woff2|png|jpg|jpeg|gif|svg|eot|ttf)$ {
    add_header Cache-Control "no-cache, no-store, must-revalidate";
    add_header Pragma "no-cache";
    expires 0;
    }


    3 - I set meta for no-cache in index.html

    <meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, proxy-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />


    4 - Exclude archive of servicework

    5 - force cache clearing from time to time

    caches.keys().then((keyList) =>
    Promise.all(
    keyList.map((key) => {
    caches.delete(key)

    }
    )
    )
    )


    I made all these attempts and still I can't kill the client cache to get my most updated .ts files, help me

    Continue reading...

Compartilhe esta Página