Fix Directus 9 CORS error when updating
Recently I updated my local version of Directus 9 to version 9.7.1 from version 9.5.0.
I was very unpleasantly surprised when I started getting CORS errors on the frontend of my site running Next.js. Of course, none of the items that I'm supposed to get from the Directus API showed up.
It turns out that with version 9.7.0 Directus team decided to turn off CORS by default so as to make the app more secure.
To quickly fix this just add
CORS_ENABLED="true" to the
.env file of your Directus 9 installation.
For other more secure suggestions check out the release notes for Directus 9.7.0 (it's at the bottom of the page).
Like This Post?
Consider supporting me on Patreon.
...or you can share this post, that also helps ;)