Apollo server just ignores my CORS layer and applies its own options.
Despite setting the CORS middleware with the option to reflect the origin with the following code:
var corsOptions = {
origin: true, //This will just copy the request origin and put it in response
optionsSuccessStatus: 200,
credentials: true,
};
app.use(cors(corsOptions));
const apolloServer = new ApolloServer({ schema, context , playground: true});
await apolloServer.start();
//Integrate with express
apolloServer.applyMiddleware({app, path: '/api/graphql', cors: corsOptions});
Apollo server just ignores my CORS layer and returns 'Access-Control-Allow-Origin' : "\*"
and because of that I get a CORS error because:
the value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.