about cors settings
codebdy opened this issue · 3 comments
I think your solution is a good one.
It's unclear to me how a GraphQL server (library) should respond to an OPTIONS
request. I skimmed the draft specification for GraphQL over HTTP and I only see POST
and GET
mentioned.
I think handling CORS requests in your own middleware wrapped around the gateway is probably the best choice for now. Perhaps if there's precedent from other GraphQL servers or some clarification in the spec, then we could support OPTIONS
in gateway natively.
You could adopt a similar HTTP handler for OPTIONS
to the one provided in cmd/gateway
here:
Lines 48 to 59 in 3c19e01
The library though may need to wait to adopt this until the GraphQL community establishes the right path forward. I'd be happy to reopen this once that becomes clearer.