From 24773c6536bec98868b2b00a97cce9afec1c7454 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Sun, 4 Sep 2022 19:04:14 -0700 Subject: [PATCH] Revert "Add CORS headers to dream server to ease integration with third-party web interfaces" (#371) This reverts commit 91e826e5f425333674d1e3bec1fa1ac63cfb382d. --- ldm/dream/server.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/ldm/dream/server.py b/ldm/dream/server.py index 0427cfd56b6..1c9508e7921 100644 --- a/ldm/dream/server.py +++ b/ldm/dream/server.py @@ -16,8 +16,6 @@ class DreamServer(BaseHTTPRequestHandler): def do_GET(self): if self.path == "/": self.send_response(200) - self.send_header("Access-Control-Allow-Origin", "*") - self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") self.send_header("Content-type", "text/html") self.end_headers() with open("./static/dream_web/index.html", "rb") as content: @@ -35,8 +33,6 @@ def do_GET(self): elif self.path == "/cancel": self.canceled.set() self.send_response(200) - self.send_header("Access-Control-Allow-Origin", "*") - self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") self.send_header("Content-type", "application/json") self.end_headers() self.wfile.write(bytes('{}', 'utf8')) @@ -59,8 +55,6 @@ def do_GET(self): def do_POST(self): self.send_response(200) - self.send_header("Access-Control-Allow-Origin", "*") - self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") self.send_header("Content-type", "application/json") self.end_headers() @@ -205,11 +199,6 @@ def image_progress(sample, step): print(f"Canceled.") return - def do_OPTIONS(self): - self.send_response(200) - self.send_header("Access-Control-Allow-Origin", "*") - self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") - self.end_headers() class ThreadingDreamServer(ThreadingHTTPServer): def __init__(self, server_address):