Skip to content

Commit

Permalink
Allow multiple CORS origins (#2031)
Browse files Browse the repository at this point in the history
* Permit cmd override for CORS modification

* Enable multiple origins for CORS

* Remove CMD_OVERRIDE

* Revert executable bit change

* Defensively convert list into string

* Bad if statement

* Retry rebase

* Retry rebase

Co-authored-by: Chris Dawson <[email protected]>
  • Loading branch information
xrd and Chris Dawson authored Jan 4, 2023
1 parent 5d69bd4 commit 91eb84c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/invoke_ai_web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ def setup_flask(self):
}

if opt.cors:
socketio_args["cors_allowed_origins"] = opt.cors
_cors = opt.cors
# convert list back into comma-separated string,
# be defensive here, not sure in what form this arrives
if isinstance(_cors, list):
_cors = ",".join(_cors)
if "," in _cors:
_cors = _cors.split(",")
socketio_args["cors_allowed_origins"] = _cors

frontend_path = self.find_frontend()
self.app = Flask(
Expand Down

0 comments on commit 91eb84c

Please sign in to comment.