Score:1

How do I add the __Secure prefix in this .htaccess line?

cz flag

Sorry, I'm not an Apache expert.

I need to add the __Secure prefix to this htaccess line:

Header onsuccess edit Set-Cookie (.*) "$1; SameSite=Strict; Secure"

is this possible? How?

Life after Guest avatar
cz flag
@EsaJokinen Sorry, I meant Apache because of the usage of htaccess files
Score:1
cn flag

ORIGINAL RESPONSE

Does this give you the information you need:

https://geekflare.com/httponly-secure-cookie-apache/

Implementation Procedure in Apache

  • Ensure you have mod_headers.so enabled in Apache HTTP server

  • Add following entry in httpd.conf:

    Header always edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
    
  • Restart Apache HTTP server to test

UPDATE 2022-12-21 @ 20:58GMT

Guidance on this site indicates the format to be Set-Cookie: __Secure-ID=123; Secure; Domain=example.com; HttpOnly

Also following MDN syntax, from your example, I would expect you need:

Header onsuccess edit Set-Cookie (.*) "__Secure-$1; SameSite=Strict; Secure"

You might also want to add in ; HttpOnlystrong text too at the end.

Header onsuccess edit Set-Cookie (.*) "__Secure-$1; SameSite=Strict; Secure; HttpOnly"
Life after Guest avatar
cz flag
This does not add the __Secure prefix
Aubs avatar
cn flag
[This](https://webhint.io/docs/user-guide/hints/hint-validate-set-cookie-header/) site is probably useful: `Set-Cookie: __Secure-ID=123; Secure; Domain=example.com; HttpOnly`, as is the [MDN syntax](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#syntax), so in your example, I would expect you need `Header onsuccess edit Set-Cookie (.*) "__Secure-$1; SameSite=Strict; Secure"` - You might also want to add in `; HttpOnly` too at the end.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.