diff --git a/ahserver/baseProcessor.py b/ahserver/baseProcessor.py index c84a48e..a3ae79c 100755 --- a/ahserver/baseProcessor.py +++ b/ahserver/baseProcessor.py @@ -79,10 +79,15 @@ class BaseProcessor(AppLogger): await self.datahandle(request) return self.content + def set_response_headers(self, response): + response.headers['Access-Control-Expose-Headers'] = 'AIOHTTP_SESSION' + response.headers['Access-Control-Allow-Credentials'] = 'true' + response.headers['Access-Control-Allow-Origin'] = '47.93.12.75' + async def handle(self,request): await self.execute(request) if self.retResponse is not None: - self.retResponse.headers['Access-Control-Expose-Headers'] = 'Set-Cookie' + self.set_response_headers(self.retResponse) return self.retResponse elif type(self.content) == type({}) : self.content = json.dumps(self.content, @@ -93,7 +98,9 @@ class BaseProcessor(AppLogger): self.headers['Content-Type'] = "application/json; utf-8" self.headers['Access-Control-Expose-Headers'] = 'Set-Cookie' - return Response(text=self.content,headers=self.headers) + resp = Response(text=self.content,headers=self.headers) + self.set_response_headers(resp) + return resp async def datahandle(self,request): self.debug('*******Error*************')