I have recently migrated my flask app into PythonAnywhere. As a responsible web admin I add the HTTP header X-Clacks-Overhead: GNU Terry Pratchett. That was fine with my previous host but PythonAnywhere adds that header too. So my web pages are served up with two copies of that header. The static pages correctly have one.
I tried to mitigate the issue with this bit of code. OpenResty presumably adds its headers after mine.
@app.after_request def gnu_terry_pratchett(resp): if not resp.headers.has_key('X-Clacks-Overhead'): resp.headers.add('X-Clacks-Overhead', 'GNU Terry Pratchett') return resp
Would it be possible to configure OpenResty to do the same thing? If not I will just change my if condition to some sort of is_python_anywhere().