Fork me on GitHub
#pedestal
<
2020-03-10
>
Fredrik Meyer14:03:44

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?

ddeaguiar14:03:34

I’m not sure. Perhaps @U04VDKC4G knows?

hlship15:03:18

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

Fredrik Meyer14:03:09

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

jackson21:03:30

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