Skip to content

Commit

Permalink
support cross orgin
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiang Chen authored and Qiang Chen committed Oct 2, 2023
1 parent 093465f commit 1c210a6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gomoku/script/tornado_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@

class MainHandler(tornado.web.RequestHandler):

def set_default_headers(self):
# Allow all origins to access this resource
self.set_header("Access-Control-Allow-Origin", "*")
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
self.set_header("Access-Control-Allow-Methods", "POST, GET, OPTIONS")

def options(self):
# no body
self.set_status(204)
self.finish()

def get(self):
self.set_header('Content-type', 'application/json')
self.set_header('Access-Control-Allow-Origin', '*')
Expand Down

0 comments on commit 1c210a6

Please sign in to comment.