2

I've created an application using Angular and Angular CLI.

To publish, I run ng build --prod --aot. It produces a dist folder that I upload to the web server and enjoy seeing it in action.

Yet I've configured my web server to cache things.

When a user gets the current version of my SPA, index.html and all .js files and all .css files are all cached.

Now that I'm deploying new version, though all of the new .js and .css files are versioned, but the old index.html is till there and it's cached.

I've used Cache-Control: no-cache header, but seems that browsers are not consistent in this area.

Is it possible to configure Angular CLI to version index.html too?

  • 1
    No, that doesn't make sense - the browser is going to request the page and the server will respond with `index.html` by default. You need to correctly configure the server caching to exclude the HTML, this isn't a problem with Angular or the CLI. – jonrsharpe Jul 17 '18 at 09:56
  • @jonrsharpe, the problem is that browsers are not consistent regarding caching. We excluded that item from server's caching, and we also explicitly added `no-cache`. But it didn't work. – Mostafa Fathollahi Jul 17 '18 at 10:54

0 Answers0