问题原文
原帖链接 · Michael H · CC BY-SA 4.0
I am using Apache 2.4.6 on an up-to-date installation of CentOS 7.9. I have tried all variations of setting a header like below (adding/removing quotes, changing the regular expression, etc.) but the Set-Cookie header is never modified when sent to the user. Every article I find trying to accomplish this says it works but it just does not work for me.
Header always set TestBefore 1
Header always edit Set-Cookie ^(.*)$ "$1; SameSite=Strict; Secure"
Header always set TestAfter 1
Both the before and after headers are sent but the Set-Cookie header is never modified. Any idea what the issue could be?
已采纳解答
原帖链接 · Andrew Schulman · CC BY-SA 4.0
Your Set-Cookie header is being set in the onsuccess condition, not the always condition. Those are different sets. You need
Header onsuccess edit Set-Cookie (.*) "$1; SameSite=Strict; Secure"
Or just leave out onsuccess, since it's the default. See Header.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
