Skip to content

Help with CORS in Nuxt/Laravel for image upload #31

Open
@eokwukwe

Description

Hello @blowstack.

I will need help in dealing with the cors error I am having when I try to upload images.

I am using Laravel for my API with authentication using Laravel Sanctum. This means that I have to set withCredentials to true in the simpleUpload option. So I have

simpleUpload: {
  uploadUrl: <api_upload_url>,
  withCredentials: true,
  headers: {
    'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN'),
  },
},

But I still get cors error. I have tried adding 'Access-Control-Allow-Origin': '*' to the headers but it didn't work. However, every other request to the API works.

Any idea what I am missing?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions