snssll / poe2openai

A tool that converts the POE developer API to the standard OpenAI API format.
https://hub.docker.com/r/1ynn/poe2openai/tags
19 stars 2 forks source link

CORS error while use NextChat #4

Closed Luo-hongyi closed 4 months ago

Luo-hongyi commented 4 months ago

Access to fetch at 'http://localhost:8765/v1/chat/completions' from origin 'https://app.nextchat.dev/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Luo-hongyi commented 4 months ago
...
app = FastAPI()
app.add_middleware(
    CORSMiddleware,
    allow_origins=["https://app.nextchat.dev"],
    allow_credentials=True,
    allow_methods=["GET", "POST", "OPTIONS"],
    allow_headers=["Content-Type", "Authorization"],
)