server: send Access-Control-Allow-Private-Network on CORS responses
Lets a public-hosted PWA reach a local simtrace2-pysniff-server (http://127.0.0.1:8081); without it the browser blocks the preflight before any request is sent.
This commit is contained in:
1 parent
e5a6000bfe
commit
73f40ad570
1 file changed
+3
@@ -36,6 +36,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.send_header('Access-Control-Allow-Methods', 'GET, POST, PATCH, DELETE, OPTIONS')
|
||||
self.send_header('Access-Control-Allow-Headers', 'Content-Type')
|
||||
self.send_header('Access-Control-Allow-Private-Network', 'true')
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
@@ -45,6 +46,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
self.send_header('Content-Length', len(data))
|
||||
self.send_header('Content-Disposition', _content_disposition(filename))
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.send_header('Access-Control-Allow-Private-Network', 'true')
|
||||
self.end_headers()
|
||||
self.wfile.write(data)
|
||||
|
||||
@@ -74,6 +76,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.send_header('Access-Control-Allow-Methods', 'GET, POST, PATCH, DELETE, OPTIONS')
|
||||
self.send_header('Access-Control-Allow-Headers', 'Content-Type')
|
||||
self.send_header('Access-Control-Allow-Private-Network', 'true')
|
||||
self.end_headers()
|
||||
|
||||
# --- GET ---
|
||||
|
||||
Reference in new issue
Block a user