graphql-link icon indicating copy to clipboard operation
graphql-link copied to clipboard

Add CORS setup

Open wtrocki opened this issue 4 years ago • 6 comments

It seems that docker image provided is not working. Some issues we saw when gw is containerized.

  • Cors are not enabled, so impossible to hook in OVP queries into it.

  • I need to change the network interface to 0.0.0.0 instead of localhost, to get me to work expose the 8080 and use GraphiQL IDE it from my browser.

  • Somehow I cannot proxy requests deployed. This happens also in my machine locally as I am seeing these warning messages when starting gw: docker run -it --rm -p 4000:8080 quay.io/graphql/ovp-gateway 2020/10/13 15:34:18 loaded previously stored schema: upstreams/gateway.graphql 2020/10/13 15:34:18 loaded previously stored schema: upstreams/serverless1.graphql 2020/10/13 15:34:18 The upstream does not have any query entry points 2020/10/13 15:34:18 The upstream does not have any query entry points 2020/10/13 15:34:18 The upstream does not have any mutation entry points 2020/10/13 15:34:18 The upstream does not have any subscription entry points 2020/10/13 15:34:18 GraphQL endpoint is running at http://[::]:8080/graphql 2020/10/13 15:34:18 Gateway GraphQL IDE is running at http://[::]:8080/graphiql

wtrocki avatar Oct 13 '20 18:10 wtrocki

Could not figure out how to add cors stuff easily.

wtrocki avatar Oct 14 '20 10:10 wtrocki

Since this project uses the "net/http", I think we have to use an external library to implement cors, https://github.com/rs/cors seems to a great library for this purpose.

lmnzx avatar Feb 17 '21 14:02 lmnzx

@snxk Amazing choice!

@chirino let us know if you are against it. If not we going to add that

wtrocki avatar Feb 17 '21 14:02 wtrocki

Hey @wtrocki ! Can I work on fixing this issue?

adityaofficial10 avatar Feb 20 '21 16:02 adityaofficial10

Anyone could work on this. Let's do quick fix first - setup hardcoded header - which is one liner. Then we can extract config

wtrocki avatar Feb 20 '21 18:02 wtrocki

Sounds good to me.

chirino avatar Feb 20 '21 23:02 chirino