Intevel / nuxt-directus

🐰 Easily integrate Directus to your Nuxt application.
https://nuxt-directus.de/
MIT License
268 stars 49 forks source link

Cors Error with module #128

Closed bastianhilton closed 1 year ago

bastianhilton commented 1 year ago

Hello im using your module in my Nuxt 3 application and have the current configurations

directus: { url: process.env.DIRECTUS_URL, auth: { email: process.env.DIRECTUS_EMAIL, password: process.env.DIRECTUS_PASSWORD, token: process.env.DIRECTUS_TOKEN, } },

in my env file:

DIRECTUS_URL='http://example.com:8055/' DIRECTUS_TOKEN='-' DIRECTUS_EMAIL=support@example.com DIRECTUS_PASSWORD=Example@password //not real credentials just an example for the env.

cors error in dev console:

Access to fetch at http://example.com:8055 from origin 'http://localhost:3011' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I have selected all of my collections to have read access

Any idea what could be happening here?

Intevel commented 1 year ago

@bastianhilton Hey, are you sure that you configured your directus instance right?

bastianhilton commented 1 year ago

I have the default settings of Directus, I haven't changed anything other than make all of my collections read for the api

casualmatt commented 1 year ago

You should disable CORS on your directus, or add the domain that you are using to the CORS allow settings. https://docs.directus.io/self-hosted/config-options.html#cors