cloudflare / lua-resty-cookie

Lua library for HTTP cookie manipulations for OpenResty/ngx_lua
347 stars 160 forks source link

Unable to change samesite attribute of cookies #55

Closed Roirouge closed 1 year ago

Roirouge commented 1 year ago

2 weeks ago I started to have errors with cookies. When I checked cookie attributes, I saw "SameSite" key is always empty. I tried to use all values ("None", "Strict", "Lax") and the final result is the same, "SameSite" is empty. I modified another key of my cookie at the same time and is was well updated. Here is my cookie :

local ck, error = cookie:set({
        key = "tmp",
        value  = "xxx",
        domain = '.' .. myDomain,
        path   = "/",
        secure = true,
        httponly = true,
        samesite = "Strict",
        expires = "Thu, 7 Jun 2023 02:02:02 GMT"
    })

Do something changed with the last release ?

maurizioabba commented 1 year ago

unlikely, the last release (4 weeks ago) regarded the prefix for our releases (https://github.com/cloudflare/lua-resty-cookie/pull/50/files), nothing changed in the code itself

Roirouge commented 1 year ago

Yes, it does seems to be related to the last release. I do not understand, I tried all tuples possible (samesite:"Strict", SameSite:"strict", sameSite:"Strict"..) and it does not affect my cookie. I am not able to set any value. I install the package in this way :

RUN git config --global url.https://github.com/.insteadOf git://github.com/ && luarocks install lua-resty-cookie

Is it correct ?

maurizioabba commented 1 year ago

you will have to follow-up with https://github.com/utix/lua-resty-cookie/ as that's the version being linked from luarocks