codex-storage / nim-codex

Decentralized Durability Engine
https://codex.storage
Apache License 2.0
69 stars 25 forks source link

Remove duplicate cors header for fetch manifest endpoint #970

Closed 2-towns closed 4 weeks ago

2-towns commented 4 weeks ago

The following lines are not needed:

   if corsOrigin =? allowedOrigin:
      resp.setCorsHeaders("GET", corsOrigin)
      resp.setHeader("Access-Control-Headers", "X-Requested-With")

The reason is that the headers are explicitly added when the API returns an error response, but when the response is successful, nim-presto handles that. As a result, the previous lines are adding a duplicate Access-Control-Allow-Origin header in the browser, which raises an error.

This PR addresses this issue.