go-chi / cors

CORS net/http middleware for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom header with undercore is been normilize to a header without it

ocalvet opened this issue · comments

When I configure the allow headers to the following:

AllowedHeaders:   []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token", "contact_id"},

Then I send a request from my react client using the contact_id header on the request I get the following error in the debug log:

Preflight aborted: headers '[Contactid]' not allowed

When I check the code it looks like parseHeaderList function in the utils.go file is removing the underscores from the header list.

Why is this the default behavior?

This should be fixed now for those from the future

Thanks for the fix Ted