cog
cog copied to clipboard
CORS fix for use on locahost
I had to add the following code to allow me to execute XHR requests from a local html/javascript file.
cog/python/cog/server/http.py
...
from fastapi.middleware.cors import CORSMiddleware
...
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
Thanks for sharing, @GrantSparks 👍🏼
I did an initial pass at integrating this: https://github.com/replicate/cog/pull/737