@hook('after_request')
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'

@ hook ( 'after_request' ) 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'
set some headers across all http responses .