To add headers to every outgoing response, use the @Flask.after_request
hook instead:
@app.after_request
def add_ua_compat(response):
response.headers['X-UA-Compatible'] = 'IE=Edge'
return response
There is a Flask extension that does exactly this; register the hook and add a header.