Drupal - 405 Method Not Allowed Error when making a JSON API request from a simple create-react-app

You can enable CORS support modifying the sites/default/services.yml file

cors.config:
enabled: true
allowedHeaders:
  - '*'
allowedMethods:
  - '*'
allowedOrigins:
   # Note: you need to specify the host + port where your app will run.
  - localhost:8000
exposedHeaders: false
maxAge: false
supportsCredentials: false

Maybe try ['x-csrf-token', 'authorization', 'content-type', 'accept', 'origin', 'x-requested-with'] instead.

Tags:

8