Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle cors issue #14

Merged
merged 1 commit into from
Mar 30, 2024
Merged

fix: handle cors issue #14

merged 1 commit into from
Mar 30, 2024

Conversation

Julien-R44
Copy link
Member

@Julien-R44 Julien-R44 commented Mar 30, 2024

Resolve #13

This PR results in a breaking change: the Vite middleware must be added by the user in his own kernel.ts file like this :

// file: kernel.ts

// ...
server.use([
  // ...
  () => import('@adonisjs/cors/cors_middleware'),
  () => import('@adonisjs/vite/vite_middleware'),
])

Of course, the Vite middleware must be defined AFTER the cors one.

I needed to make this change, as otherwise the Vite middleware was constantly executed BEFORE the adonisjs/cors middleware, and therefore I had no way of retrieving the cors headers to inject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant