Short question: I try to use pedestal+Lacinia to build a GraphQL endpoint. It works perfectly fine in the GraphiQL endpoint. but it fails when I try to use the endpoint in Apollo+Javascript. I get a 404 on the preflight request - and I don't know how to handle this. Any tips?
I’m not sure. Perhaps @hlship knows?
maybe make sure your config allows all origins, here's an example: https://github.com/pedestal/pedestal/blob/master/samples/template-server/src/template_server/server.clj#L34
Thanks @danvingo! Adding the line ::http/allowed-origins {:creds true :allowed-origins (constantly true)}
worked. Appears I need to learn more about cors and origins and such, because I don't understand why this worked
The URL for the websockets connection is different that the URL for normal GET/POST, which is just unavoidable due to how the Jetty stack operates. See this: https://lacinia-pedestal.readthedocs.io/en/latest/subscriptions.html#endpoint
Question about CORS.. should pedestal by default handle preflight OPTIONS requests, or do I need a route/interceptor for that?