I am following an (excellent) security tutorial by Ryan Chenkie, but trying to use a graphql api rather than a REST api which he uses.
The graphql server is running on localhost:4000 and the Apollo-React client is on localhost:3000. It works fine.
Now, I want to use a cookie for the auth token, so I need client and server to be on the same domain. Per Chenkie's recommendation I set up a proxy on the client in package.json
"proxy": "http://localhost:4000/"
then in my index.js, where apollo client is set up, I create an httplink as follows:
const link = createHttpLink({
uri: "http://localhost:3000",
headers: { authorization: token }, // The token in the auth header will be removed when the cookie approach is working)
});
For the uri I have tried the following:
uri: "http://localhost:3000"
uri: "/graphql"
uri: "/"
uri: ""
I always get a 404 error. Any idea what I am doing wrong?
Thanks for your help.