comet-ml / opik

Open-source end-to-end LLM Development Platform
Apache License 2.0
2.12k stars 132 forks source link

[OPIK-136] fix cors request header comet workspace #520

Closed idoberko2 closed 2 weeks ago

idoberko2 commented 2 weeks ago

Details

Fix CORS response headers for requests containing the comet-workspace request header.

Issues

OPIK-136

Testing

Added an E2E test that covers and tested locally.

Before this change:

❯ curl 'http://localhost:5173/api/v1/private/projects' \
  -X 'OPTIONS' \
  -H 'access-control-request-headers: comet-workspace' \
  -H 'access-control-request-method: GET' \
  -H 'origin: http://localhost:5173' \
  -i
HTTP/1.1 200 OK
Server: nginx/1.27.2
Date: Thu, 31 Oct 2024 07:20:57 GMT
Content-Length: 0
Connection: keep-alive
Vary: Origin

After this change:

❯ curl 'http://localhost:5173/api/v1/private/projects' \
  -X 'OPTIONS' \
  -H 'access-control-request-headers: comet-workspace' \
  -H 'access-control-request-method: GET' \
  -H 'origin: http://localhost:5173' \
  -i
HTTP/1.1 200 OK
Server: nginx/1.27.2
Date: Thu, 31 Oct 2024 07:10:04 GMT
Content-Length: 0
Connection: keep-alive
Vary: Origin
Access-Control-Allow-Origin: http://localhost:5173
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 1800
Access-Control-Allow-Methods: OPTIONS,GET,PUT,POST,DELETE,HEAD,PATCH
Access-Control-Allow-Headers: Authorization,Content-Type,Accept,X-Requested-With,Origin,Comet-Sdk-Api,comet-username,comet-react-ver,comet-workspace