I have a front in vue and a back in PHP.
I'm trying to set a cookie but it's not working Chrome recognises the cookie but doesn't save it.
The front is http://192.168.1.17:8080
and the back is http://192.168.1.17
I perform a post like this:
guest
.post("/user/login", formData, {
auth: {
username: process.env.VUE_APP_CLIENT_USERNAME,
password: process.env.VUE_APP_CLIENT_SECRET,
},
headers: {
"access-control-expose-headers": "Set-Cookie",
},
})
I set the cookie like this:
header("Access-Control-Allow-Origin: http://192.168.1.17:8080");
header("Access-Control-Allow-Headers: Content-Type, Authorization, Access-Control-Expose-Headers");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Access-Control-Allow-Credentials: true");
setcookie('my_cookie', 'cookie_value', time() + 3600, '/', '', false, false);
the result of the request:

but here nothing is set:

Sorry if i'm not very clear.
I want to be able to send back the cookie (withCrendtial: true)
I find something similar here but gave me nothing may be missed something: Cookies missing in Chrome dev tools application tab but visible under network section