NestJS Server CORS Issue

{“errors”:[“This operation has been blocked as a potential Cross-Site Request Forgery (CSRF). Please either specify a ‘content-type’ header (with a type that is not one of application/x-www-form-urlencoded, multipart/form-data, text/plain) or provide a non-empty value for one of the following headers: x-apollo-operation-name, apollo-require-preflight\n”]}

Getting CORS issue, how to fix it ?

This is a CSRF warning, not a CORS error - important distinction to make when you google it :wink:

Have you tried one of the solutions given in the error message? Either specify a content-type header when making a query, e.g. of type application/json, or add a header like apollo-require-preflight: true.

1 Like