'supports_credentials' => true,
Feb 18, 2021
8
Level 1
CORS problems with axios calls to laravel
Hi all, I've some troubles with axios calls from vue to a Laravel server that I made. In Server side I have this cors.php configuration:
<?php
return [
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => ['*'],
'allowed_headers' => ['*'],
'exposed_headers' => ['*'],
'max_age' => 0,
'supports_credentials' => false,
];
and when I call from vue in this way:
var href="https://authserver/api/mysql_verify";
axios.post(href,{user:'pippo',pass:'pappa'}).then(resp=>{
.....
}
}).catch(err => {
console.log("Errore "+this.$options.name+"->startLogin su chiamata "+href+": "+err);
});
I obtain this error:
NS_ERROR_DOM_BAD_URI
So I understood that it is necessary to add
Access-Control-Request-Headers
Access-Control-Request-Method
headers to server side. But cors.php is all enabled with '*' !!! What can I do? Bye and thank you
Level 39
CSFR protection ?
1 like
Please or to participate in this conversation.