chore: optionally prefix authentication related cookies (#22148)

When the deployment option is enabled auth cookies are prefixed with
`__HOST-`
([info](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie)).

This is all done in a middleware that intercepts all requests and strips
the prefix on incoming request cookies.
This commit is contained in:
Steven Masley
2026-02-20 09:01:00 -06:00
committed by GitHub
parent 1069ce6e19
commit e5f64eb21d
15 changed files with 357 additions and 6 deletions
+11
View File
@@ -1058,6 +1058,17 @@ Controls if the 'Secure' property is set on browser session cookies.
Controls the 'SameSite' property is set on browser session cookies.
### --host-prefix-cookie
| | |
|-------------|------------------------------------------|
| Type | <code>bool</code> |
| Environment | <code>$CODER_HOST_PREFIX_COOKIE</code> |
| YAML | <code>networking.hostPrefixCookie</code> |
| Default | <code>false</code> |
Recommended to be enabled. Enables `__Host-` prefix for cookies to guarantee they are only set by the right domain.
### --terms-of-service-url
| | |