|
@@ -14,10 +14,12 @@ class BaseHandler(RequestHandler):
|
|
self._status_code = 200
|
|
self._status_code = 200
|
|
self.executor = ThreadPoolExecutor(200)
|
|
self.executor = ThreadPoolExecutor(200)
|
|
self.settings['allow_remote_access']=True
|
|
self.settings['allow_remote_access']=True
|
|
|
|
+ origin_url = self.request.headers.get('Origin')
|
|
self.set_header('Content-Type', 'application/json')
|
|
self.set_header('Content-Type', 'application/json')
|
|
self.set_header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS")
|
|
self.set_header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS")
|
|
self.set_header("Access-Control-Allow-Headers", "Content-Type, Depth, User-Agent, Token, Origin, X-Requested-With, Accept, Authorization, admin_id")
|
|
self.set_header("Access-Control-Allow-Headers", "Content-Type, Depth, User-Agent, Token, Origin, X-Requested-With, Accept, Authorization, admin_id")
|
|
- self.set_header('Access-Control-Allow-Origin', "*")
|
|
|
|
|
|
+ self.set_header('Access-Control-Allow-Origin', origin_url)
|
|
|
|
+ self.set_header("Access-Control-Allow-Credentials", "true")
|
|
|
|
|
|
def write_json(self, data, status_code=200, msg='success'):
|
|
def write_json(self, data, status_code=200, msg='success'):
|
|
self.write(json.dumps({'status': {'msg': msg, "RetCode": status_code}, 'data': data}))
|
|
self.write(json.dumps({'status': {'msg': msg, "RetCode": status_code}, 'data': data}))
|