title: Cache busting index.html in a .Net Core Angular 5 website
body: <p>I am creating a website using .Net core and angular 5. I created the project using the latest .Net core angular template (using <code>dotnet new angular</code> with .Net core 2.1 installed).</p>
  
  <p>This project uses the angular cli to build/package and applies a hash onto the bundled js and css files:</p>
  
  <p><a href="https://i.stack.imgur.com/rBpin.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rBpin.png" alt="enter image description here"></a></p>
  
  <p>However after publishing my site to an azure app service I found that when I browsed to the site I would see the old version until I manually refreshed with F5 (Ctrl-F5 wasn't necessary). This seems to be because although the js/css files wont be cached, the index.html page which contains the references to these files will be served from the cache.</p>
  
  <p>When I press F5 to reload the website the index.html (<code>home</code> below) is requested from the site (304 in this case as it hasn't changed, if it has it will get the latest):</p>
  
  <p><a href="https://i.stack.imgur.com/rPfuk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rPfuk.png" alt="enter image description here"></a></p>
  
  <p>However when I initially load the page (via a bookmark or typing in the address etc) the page is directly served from cache:</p>
  
  <p><a href="https://i.stack.imgur.com/n2yV5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/n2yV5.png" alt="enter image description here"></a></p>
  
  <p>Is this expected behaviour? Why is it different loading the page for the first time vs pressing F5? And can I/should I prevent this caching?</p>