-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CORS for openai api server #481
Conversation
@aisensiy could you please explain more about the motivation? |
CORS (Cross-Origin Resource Sharing) is a security mechanism implemented by web browsers to protect users from unauthorized access to their data. It allows web pages running on different domains to interact with each other. By adding CORS support, it enables this api to respond to requests from other domains. For example this project running on
|
Shouldn't the server who is listening to 3000 port deal with it? |
No, the api provider should handle it. The api provider provide the CORS headers to tell others which origin can access the api. cors-error.mp4Please read more information about this in https://fastapi.tiangolo.com/tutorial/cors/ |
@AllentDan @lvhan028 So there is still some concerns about this PR? |
Can we make it an option just like FastChat? |
@aisensiy Excellent, please make it as an option, enable CORS by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it optional, enable CORS by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
Support CORS for openai api.
Modification
Add CORS headers.
BC-breaking (Optional)
Use cases (Optional)
Checklist