-
Notifications
You must be signed in to change notification settings - Fork 635
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
Configurable CORS and site headers #15397
Conversation
Hi Brandon @brandonkelly, When I try to login from the Nuxt.js application using Is there a way to handle the "preflight request"? Best |
@vettndr The <?php
return [
'as corsFilter' => [
'class' => \craft\filters\Cors::class,
'cors' => [
'Origin' => [
'https://my-nuxt-app.com',
],
'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
'Access-Control-Request-Headers' => ['*'],
'Access-Control-Allow-Credentials' => true,
'Access-Control-Max-Age' => 86400,
'Access-Control-Expose-Headers' => [],
],
],
]; |
Hey @timkelty I tried as you suggested me.... and now I'm facing a
I'm pretty sure the credentials I'm using are working in the backend when I try to access on it. Thanks in advance for your support. Best |
@vettndr your request is failing CSRF validation. You need to fetch a CSRF token first, then include it along with your request. |
@timkelty yes, I’m fetching the CSRF token when the app is loaded for the first time and then I’m including it in the POST request. I don’t know why it’s triggering that 400 exception. |
How are you making the request (fetch, axios, etc)? |
Hi @timkelty
as you can see I'm setting the best |
What are the domains involved? Are they subdomains of the same root? I'm not seeing anything jump out from your example, so if you could, please email [email protected] with as much of the project as possible, specifically:
|
Hi @timkelty Anyway I did a little debugging process and I found that in the It seems like it's comparing the token I passed in the header with another one. I would really appreciate to read your thoughts about it. Best |
Description
allowedGraphqlOrigins
in favor of using CORS filterpermissionsPolicyHeader
in favor of using headers filterExample config:
config/app.web.php
Related issues