Flask change the server header

You can use Flask's make_response method to add or modify headers.

from flask import make_response

@app.route('/index')
def index():
    resp = make_response("Hello, World!")
    resp.headers['server'] = 'ASD'
    return resp

@bcarroll's answer works but it will bypass other processes defined in original process_response method such as set session cookie. To avoid the above:

class localFlask(Flask):
    def process_response(self, response):
        #Every response will be processed here first
        response.headers['server'] = SERVER_NAME
        super(localFlask, self).process_response(response)
        return(response)

You can change the Server header for every response by overriding the Flask.process_response() method.

    from flask import Flask
    from flask import Response

    SERVER_NAME = 'Custom Flask Web Server v0.1.0'

    class localFlask(Flask):
        def process_response(self, response):
            #Every response will be processed here first
            response.headers['server'] = SERVER_NAME
            return(response)

    app = localFlask(__name__)


    @app.route('/')
    def index():
        return('<h2>INDEX</h2>')

    @app.route('/test')
    def test():
        return('<h2>This is a test</h2>')

http://flask.pocoo.org/docs/0.12/api/#flask.Flask.process_response