title: Flask - Javascript file requires multiple page refresh to load net::ERR_INVALID_HTTP_RESPONSE 200
body: <p>I have a Flask app that relies on javascript for certain functionality.
  The javascript file loads fine sometimes and other times I get an error in the console:</p>
  <pre><code>GET http://localhost:5000/static/js/sm4sb.js net::ERR_INVALID_HTTP_RESPONSE 200
  </code></pre>
  <p>When this happens the javascript is not loaded. I then have to refresh the page multiple times until the console does not show this error.</p>
  <p>I read somewhere that putting this in my config.py file should fix it, but it doesn't</p>
  <pre><code>SEND_FILE_MAX_AGE_DEFAULT = 0
  </code></pre>
  <p>Elsewhere someone suggested adding this:</p>
  <pre><code>@app.after_request
  def add_header(response):
      response.headers['Cache-Control'] = 'no-cache, no-store'
  </code></pre>
  <p>But when I do that I get an error</p>
  <pre><code>AttributeError
  AttributeError: 'NoneType' object has no attribute 'vary'
  </code></pre>
  <p>Note that the issue is with Chrome, it works without an issue running in Firefox.</p>
  <p>EDIT: I have found a few references that suggest this is a Flask issue and to downgrade to an earlier version. I will try that and report back.</p>