Set cookie for worker, access by worker not working.

I have been spinning my wheels for a couple of days on this. I don't believe that this is the same CORS request that a bunch folks have asked. All of my CORS values are set.
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",
"Access-Control-Max-Age": "86400",
"Access-Control-Allow-Credentials": true,
};
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",
"Access-Control-Max-Age": "86400",
"Access-Control-Allow-Credentials": true,
};
I am hosting my UI on a different domain. For now, it is a localhost domain. I am access my worker by way of API. I am returning a Set-Cookie value on the response of the API call. I can see that value in the developer tools of Chrome. However when I got to make a get request on the same worker, the cookie is gone. I checked the application tab of developer tools for the cookie, no luck. Basically the need is this. I want to assign a reward to you for calling the URL, and if I don't know who you are, I want you to register. How do I crack this nut?
2 Replies
Paul Shriner - Titleless
It was all CORS related, with Axios. For anyone in the future looking into this. You have to add: Access-Control-Allow-Credentials: true to your Cors response and set, withCredentials on your request.
isrealbm
isrealbm10mo ago
withCredentials will not work with cloudflare-workers
Want results from more Discord servers?
Add your server