Skip to content

Commit

Permalink
Add CORS headers to JSON handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
inaimathi committed Mar 20, 2024
1 parent 864be60 commit 313a57a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.py
Expand Up @@ -42,6 +42,10 @@ def prepare(self):
if self.request.remote_ip in IP_BLACKLIST:
return self.json({"status": "whoops"}, 403)

self.set_header("Access-Control-Allow-Origin", "*")
self.set_header("Access-Control-Allow-Headers", "*")
self.set_header("Access-Control-Allow-Methods", "*")

def set_default_headers(self):
self.set_header("Content-Type", "application/json")

Expand Down

0 comments on commit 313a57a

Please sign in to comment.