From f37540286c207ebfed422460dbf9c9b4a2ef3cf1 Mon Sep 17 00:00:00 2001 From: Nikhil Rao Date: Sun, 12 Feb 2023 13:48:05 -0800 Subject: [PATCH] Fix cors origin (#525) --- pynecone/app.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pynecone/app.py b/pynecone/app.py index b6a412b61..7cc676ee0 100644 --- a/pynecone/app.py +++ b/pynecone/app.py @@ -75,7 +75,7 @@ class App(Base): # Set up the API. self.api = FastAPI() - self.add_cors(config.cors_allowed_origins) + self.add_cors() self.add_default_endpoints() # Set up CORS options. @@ -124,16 +124,10 @@ class App(Base): # To test the server. self.api.get(str(constants.Endpoint.PING))(ping) - def add_cors(self, allowed_origins: Optional[List[str]] = None): - """Add CORS middleware to the app. - - Args: - allowed_origins: A list of allowed origins. - """ - allowed_origins = allowed_origins or ["*"] + def add_cors(self): + """Add CORS middleware to the app.""" self.api.add_middleware( cors.CORSMiddleware, - allow_origins=allowed_origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"],