pedestal

Fredrik Meyer 2020-03-10T14:43:44.023200Z

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?

2020-03-10T14:46:34.023300Z

I’m not sure. Perhaps @hlship knows?

2020-03-10T14:47:37.023900Z

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

Fredrik Meyer 2020-03-10T14:59:09.024900Z

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

hlship 2020-03-10T15:56:18.025Z

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

jackson 2020-03-10T21:13:30.026800Z

Question about CORS.. should pedestal by default handle preflight OPTIONS requests, or do I need a route/interceptor for that?