1

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?

1
  • @EsaJokinen Sorry, I meant Apache because of the usage of htaccess files Dec 18, 2022 at 14:17

1 Answer 1

1

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"
2
  • This does not add the __Secure prefix Dec 19, 2022 at 9:54
  • 1
    This site is probably useful: Set-Cookie: __Secure-ID=123; Secure; Domain=example.com; HttpOnly, as is the MDN 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.
    – Aubs
    Dec 19, 2022 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .