Skip to content

Commit 2121d09

Browse files
ganteqgallouedecArthurZucker
authored
[serve] add cors warnings (#40112)
* add cors warnings * Update src/transformers/commands/serving.py Co-authored-by: Quentin Gallouédec <[email protected]> * Update src/transformers/commands/serving.py Co-authored-by: Arthur <[email protected]> * Apply suggestions from code review * make fixup --------- Co-authored-by: Quentin Gallouédec <[email protected]> Co-authored-by: Arthur <[email protected]>
1 parent b40b834 commit 2121d09

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/transformers/commands/serving.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,13 @@ def run(self):
634634
allow_methods=["*"],
635635
allow_headers=["*"],
636636
)
637+
logger.warning_once(
638+
"CORS allow origin is set to `*`. This is not recommended for production environments."
639+
)
640+
else:
641+
logger.warning_once(
642+
"Some apps may require CORS. Consider launching the server with `--enable-cors` if you see errors."
643+
)
637644

638645
@app.post("/v1/chat/completions")
639646
def chat_completion(request: dict):

0 commit comments

Comments
 (0)