mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Fix HTTP cookie caching
- Use "Expires" instead of "Max-Age" when using a cookie date (Max-Age is used with an interval of seconds in the future: https://en.wikipedia.org/wiki/HTTP_cookie#Expires_and_Max-Age) - Fix cookie dates to be compliant with specifications Fixes errors with various "picky" clients (for example, Lightroom/Piwigo plugin).
This commit is contained in:
parent
1faf47e6b2
commit
fb99ee2177
1 changed files with 4 additions and 4 deletions
|
@ -131,11 +131,11 @@ end
|
||||||
function delete_cookie()
|
function delete_cookie()
|
||||||
conf = config.get_config()
|
conf = config.get_config()
|
||||||
|
|
||||||
expired_time = "Thu, Jan 01 1970 00:00:00 UTC;"
|
expired_time = "Thu, 01 Jan 1970 00:00:00 UTC;"
|
||||||
for _, domain in ipairs(conf["domains"]) do
|
for _, domain in ipairs(conf["domains"]) do
|
||||||
local cookie_str = "; Domain=."..domain..
|
local cookie_str = "; Domain=."..domain..
|
||||||
"; Path=/"..
|
"; Path=/"..
|
||||||
"; Max-Age="..expired_time
|
"; Expires="..expired_time
|
||||||
ngx.header["Set-Cookie"] = {
|
ngx.header["Set-Cookie"] = {
|
||||||
"SSOwAuthUser="..cookie_str,
|
"SSOwAuthUser="..cookie_str,
|
||||||
"SSOwAuthHash="..cookie_str,
|
"SSOwAuthHash="..cookie_str,
|
||||||
|
@ -147,9 +147,9 @@ end
|
||||||
|
|
||||||
-- Expires the redirection cookie
|
-- Expires the redirection cookie
|
||||||
function delete_redirect_cookie()
|
function delete_redirect_cookie()
|
||||||
expired_time = "Thu, Jan 01 1970 00:00:00 UTC;"
|
expired_time = "Thu, 01 Jan 1970 00:00:00 UTC;"
|
||||||
local cookie_str = "; Path="..conf["portal_path"]..
|
local cookie_str = "; Path="..conf["portal_path"]..
|
||||||
"; Max-Age="..expired_time
|
"; Expires="..expired_time
|
||||||
ngx.header["Set-Cookie"] = "SSOwAuthRedirect=;" ..cookie_str
|
ngx.header["Set-Cookie"] = "SSOwAuthRedirect=;" ..cookie_str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue