Resolving the "304 Not Modified" Google Chrome "CSS not loading on refresh" issue

Posted: Friday 24 May 2013

As a web developer, I am disappointed by the fact that Chrome 27 broke many features and functionality that was implemented and included in Chrome 24. That said, resolving Google Chrome's issue of not being able to reload CSS that it decides to 304 Not Modified was not an easy task..
Now why is this issue a bad thing? Well first of all, CSS is the code that powers the visual elements of a website, but of course you already know this.. Having the stylesheet [CSS] to be 304'd means that the browser saves it up and uses a version in it's own cache if it guesses that the file that it has cached is the same as the one on the server.
However the issue here is that Chrome is unable to use the CSS that it fetches from the cache, leading to ugly websites that don't look like much...
This is notable when refreshing the page, and when the 304 issue becomes evident...
Unfortunately, the network tools reveal nothing apart from the fact that the external CSS files of the page is being served with the mimetype of text/html and has been returned with the code of "304 not modified".
However, after quite some experimenting, the solution to this issue was to force the server (Python + Flask) to return the stylesheet file with a status code of 200:
return response, 200