allow docker to bypass CORS w/env var DISABLE_CORS
It isn't documented in the README as it won't work on existing catalog of images. It is only for new images.
Signed-off-by: Jesse Andrews [email protected]
I haven't looked at an automated test yet
Thinking about this further it seems like having a command like:
cog serve r8.im/zeke/haiku-standard@sha256:78458ba6976fb7d159f9f3a336754d9e8467110c0fb7e8a2c86d93ccdb524f03
in cog serve you can address issues not directly related to the model:
- handle CORS #713
- static files #687
- file handling #496 - and additionally where we can upload to GCS/S3/R2 or store in a local filesystem
- make api consistent between requests against a local docker deploy and replicate deployment
Why not do this in python cog.server.http
- baking non-model specific code into models couple / complicate improvements to serving experience / existing cog'd model will always have older versions of "serve" (docker images)
- move file access/uploading outside of docker images to focus solely on running the model, not integrations beyond model
I haven't looked at the go code beyond determining how the python code is injected during model build time. Perhaps this is a poor idea that I'll see once I try to look at prototyping this.
see POC in #738
The name DISABLE_CORS is a bit ambiguous, as it could be taken to mean "do not allow cross-origin requests" or "allow any cross-origin request". Maybe something more explicit like BYPASS_CORS or CORS_ALLOW_ALL?
hey I am blocked on this cors its a small thing but due to this its becoming pain for me to use the cog further. can we just get this rolling in ?
Blocked by this as well. Generally running Cog-powered models on production seem to be very restricted due to the fact that the http server is not modifiable. Allowing to modify the underlying FastAPI server would be greatly helpful.
I am patching and using it myself. I hope this PR will be incorporated into production soon.
Is this getting in any time soon? Or is there an alternative way to change CORS settings on the server?