Azure / Azure/azure-functions-core-tools
How to set custom headers for CORS use?
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 498
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 14
Description
I'm trying to add a custom header `Attachment-Name` to the response returned by an HTTP get triggered azure function (written in typescript, using v4 programming model, running with Azure Functions Core Tools Version: 4.0.5907 and Function Runtime Version: 4.834.3.22875. I have `"Host": { "CORS": "*" }` set in my local.settings.json file. However, when I call the azure function from the browser, I only get the CORS white listed headers in the browser. I tried setting `Access-Control-Allow-Headers` manually in my azure function, but that had no effect.
https://github.com/gosqasorg/asset-provenance-tracking/blob/coco-harry-attachment/packages/backend/src/functions/httpTrigger.ts#L175
How do I configure Azure Function Core Tools to allow a custom header to be accessed in a CORS browser request?
Contributor guide
Research direction
Start with the linked packages/backend/src/functions/httpTrigger.ts around line 175 and the local.settings.json CORS setting. Trace how Azure Functions Core Tools handles response headers for browser requests, then document the supported configuration and verify that a browser can read Attachment-Name from the response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, typescript
- Domain
- api, cloud
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100