def preflight(self):
        origin = self.request.headers.get('Origin', '*')

        # 'null' may be sent by the browser when the sockjs client is hosted
        # from a file:// url.
        # In such case, respond with '*' to 'null' origin, as per sockjs
        # protocol definition
        if origin == 'null':
            origin = '*'

        self.set_header('Access-Control-Allow-Origin', origin)

        headers = self.request.headers.get('Access-Control-Request-Headers')
        if headers:
            self.set_header('Access-Control-Allow-Headers', headers)

        self.set_header('Access-Control-Allow-Credentials', 'true')
Handles request authentication
dataset/ETHPy150Open flaviogrossi/sockjs-cyclone/sockjs/cyclone/basehandler.py/PreflightHandler.preflight