Closed codebdy closed 4 months ago
add this code, fixed:
is right?
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: https://github.com/nautilus/gateway/blob/3c19e01d118981add189ca7abe5e56a784918455/cmd/gateway/http.go#L48-L59
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.
Hi, Dears i meet cors problem,when client seent "OPTION" requet, get 405 error, I find the source not not process "OPTION" method :![image](https://github.com/nautilus/gateway/assets/18096128/9858023b-660f-4a0a-84de-40e6bbeb82bd)
Is any way to fixed it?