This is a follow-up
Ok, a while back I asked a question and spent a few days trying to figure this out. I'm hoping that this can direct...
For further actions, you may consider blocking this person and/or reporting abuse
Why not just add corsOptions on server.applyMiddleware
This worked for me and I didn't have to use the cors dependency
This is the only method I got cors to work with. Thanks!
Worked out too. Thanks.
Hi Ryan,
I am using the
apollo-server
to setup a node apollo server. I just deployed to heroku a production verion of my app, but I can't seem to communicate with it via the React apollo-client code. It complains of cors. I have had no success in fixing it. I have tried a lot of solutions online, but no success yet.Do you why this is happening?
Not sure off hand, it's difficult to tell without any errors I can get a look at. One thing is, I didn't use CORS in Apollo client, which you still are. I added apollo-server-express and used that.
I have switched to apollo-server-express and it still had same issues. I am not using cors from my client app
Just spent several hours trying to figure out what on Earth I could possibly not be doing correct. Somehow, among all the tutorials / q&a's / blog posts / etc out there, it seems none of them mention the crucial point that you have to turn off the default cors option. You saved my day bud! Thanks!
For me I just have to set fetchOptions in the frontend code to
{credentials: 'included'}
, I use Urql instead of Apollo-Client though.Configuration for Apollo-Server-Express is as normal (didn't have to use the cors package).
apolloServer.applyMiddleware({ app, cors: { origin: FRONTEND_URL, credentials: true } })
Ryan Doyle, great article. I'm facing the same issue with my setup. Would be awesome if you could take a look at it: stackoverflow.com/questions/642075...
omg you're the best, this apollo server cors: false nearly killed me.
Thanks a lot!
You Saved my day
Lifesaver. Thanks so much for this write up.