Skip to content

Commit

Permalink
Merge pull request #792 from Epistimio/revert-778-support-cors
Browse files Browse the repository at this point in the history
Revert "Add falcon-cors requirement to make orion server accept CORS requests"
  • Loading branch information
bouthilx authored Feb 11, 2022
2 parents 6c83831 + 776db96 commit 149d127
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"pandas",
"gunicorn",
"falcon",
"falcon-cors",
"scikit-learn",
"psutil",
"joblib",
Expand Down
13 changes: 1 addition & 12 deletions src/orion/serving/webapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"""

import falcon
from falcon_cors import CORS

from orion.serving.experiments_resource import ExperimentsResource
from orion.serving.plots_resources import PlotsResource
Expand All @@ -25,17 +24,7 @@ class WebApi(falcon.API):
"""

def __init__(self, config=None):
# By default, server will reject requests coming from a server
# with different origin. E.g., if server is hosted at
# http://myorionserver.com, it won't accept an API call
# coming from a server not hosted at same address
# (e.g. a local installation at http://localhost)
# This is a Cross-Origin Resource Sharing (CORS) security:
# https://developer.mozilla.org/fr/docs/Web/HTTP/CORS
# To make server accept CORS requests, we need to use
# falcon-cors package: https://github.com/lwcolton/falcon-cors
cors = CORS(allow_origins_list=["http://localhost:3000"])
super(WebApi, self).__init__(middleware=[cors.middleware])
super(WebApi, self).__init__()
self.config = config

setup_storage(config.get("storage"))
Expand Down

0 comments on commit 149d127

Please sign in to comment.