{"action":"opened","issue":{"url":"https://api.github.com/repos/howtographql/howtographql/issues/855","repository_url":"https://api.github.com/repos/howtographql/howtographql","labels_url":"https://api.github.com/repos/howtographql/howtographql/issues/855/labels{/name}","comments_url":"https://api.github.com/repos/howtographql/howtographql/issues/855/comments","events_url":"https://api.github.com/repos/howtographql/howtographql/issues/855/events","html_url":"https://github.com/howtographql/howtographql/issues/855","id":395297851,"node_id":"MDU6SXNzdWUzOTUyOTc4NTE=","number":855,"title":"Allow CORS in Java GraphQL Jetty Server ","user":{"login":"jpizagno","id":9384286,"node_id":"MDQ6VXNlcjkzODQyODY=","avatar_url":"https://avatars3.githubusercontent.com/u/9384286?v=4","gravatar_id":"","url":"https://api.github.com/users/jpizagno","html_url":"https://github.com/jpizagno","followers_url":"https://api.github.com/users/jpizagno/followers","following_url":"https://api.github.com/users/jpizagno/following{/other_user}","gists_url":"https://api.github.com/users/jpizagno/gists{/gist_id}","starred_url":"https://api.github.com/users/jpizagno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpizagno/subscriptions","organizations_url":"https://api.github.com/users/jpizagno/orgs","repos_url":"https://api.github.com/users/jpizagno/repos","events_url":"https://api.github.com/users/jpizagno/events{/privacy}","received_events_url":"https://api.github.com/users/jpizagno/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-02T16:12:27Z","updated_at":"2019-01-02T16:12:27Z","closed_at":null,"author_association":"NONE","body":"My apologies if this question has already been answered, or does not belong here.  \r\n\r\nI am trying to query GraphQL (with MongoDB repository) in docker-compose via a ReactJS container, and getting this error in the ReactJS container:\r\n\r\nAccess to fetch at 'http://127.0.0.1:10001/graphql' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.\r\n\r\nI know GraphQL is working because when I open the GraphQL app on port 10001, I can run queries and mutations that are properly persisted/read to/from MongoDB container.\r\n\r\nAll three apps (ReactJS, GraphQL, MongoDB) are in docker-compose and are linked.  \r\n\r\nCan somebody tell me how to allow the Java GraphQL to allow CORS?\r\n(i.e. I have a GraphQLEndpoint.java class that extends SimpleGraphQLServlet, with @WebServlet(urlPatterns = \"/graphql\") )\r\n \r\nI tried to set the Jetty Server parameters in WEB-INF/web.xml, but then GraphQL does not work.  \r\n\r\nI see examples for allowing CORS in a Javascript server, but I would prefer to use Java.  \r\n\r\nthanks in advance for any help"}}
{"actor":{"display_login":"jpizagno"}}