Skip to content
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

how to deal with CORS policy violation #3

Open
a21211 opened this issue Jun 8, 2024 · 1 comment
Open

how to deal with CORS policy violation #3

a21211 opened this issue Jun 8, 2024 · 1 comment

Comments

@a21211
Copy link

a21211 commented Jun 8, 2024

Access to fetch at 'http://ip1:11434/api/chat' from origin 'http://ip2:3000' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space private.
llm:466

how to deal with Cors ?

@v3ucn
Copy link
Owner

v3ucn commented Jun 9, 2024

just use CORSMiddleware

app.add_middleware(
    CORSMiddleware, 
    allow_origins=origins,  #设置允许的origins来源
    allow_credentials=True,
    allow_methods=["*"],  # 设置允许跨域的http方法,比如 get、post、put等。
    allow_headers=["*"])  #允许跨域的headers,可以用来鉴别来源等作用。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants