(json_header=True)
Set some headers across all HTTP responses
Set some headers across all HTTP responses
Set some headers across all HTTP responses
def security_headers(json_header=True):
    """
    Set some headers across all HTTP responses
    """
    response.headers["Server"] = "Server"
    response.headers["X-Content-Type-Options"] = "nosniff"
    response.headers["X-Frame-Options"] = "DENY"
    response.headers["X-XSS-Protection"] = "1; mode=block"
    response.headers["Pragma"] = "no-cache"
    response.headers["Cache-Control"] = "no-cache"
    response.headers["Expires"] = "0"
    if json_header:
        response.content_type = "application/json; charset=UTF-8"
def security_headers ( json_header = True ) : response . headers [ "Server" ] = "Server" response . headers [ "X-Content-Type-Options" ] = "nosniff" response . headers [ "X-Frame-Options" ] = "DENY" response . headers [ "X-XSS-Protection" ] = "1; mode=block" response . headers [ "Pragma" ] = "no-cache" response . headers [ "Cache-Control" ] = "no-cache" response . headers [ "Expires" ] = "0" if json_header : response . content_type = "application/json; charset=UTF-8"