mirror of
https://github.com/containous/traefik.git
synced 2025-11-05 16:23:55 +03:00
Support domain configuration for sticky cookies
This commit is contained in:
@@ -322,6 +322,14 @@ you'd add the tag `traefik.http.services.{name-of-your-choice}.loadbalancer.pass
|
||||
traefik.http.services.myservice.loadbalancer.sticky.cookie.samesite=none
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.domain`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
```yaml
|
||||
traefik.http.services.myservice.loadbalancer.sticky.cookie.domain=foo.com
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.maxage`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
@@ -437,6 +437,14 @@ you'd add the label `traefik.http.services.<name-of-your-choice>.loadbalancer.pa
|
||||
- "traefik.http.services.myservice.loadbalancer.sticky.cookie.samesite=none"
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.domain`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
```yaml
|
||||
- "traefik.http.services.myservice.loadbalancer.sticky.cookie.domain=foo.com"
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.maxage`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
@@ -324,6 +324,14 @@ you'd add the label `traefik.http.services.{name-of-your-choice}.loadbalancer.pa
|
||||
traefik.http.services.myservice.loadbalancer.sticky.cookie.samesite=none
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.domain`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
```yaml
|
||||
traefik.http.services.myservice.loadbalancer.sticky.cookie.domain=foo.com
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.maxage`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
@@ -357,6 +357,7 @@ Register the `IngressRoute` [kind](../../reference/dynamic-configuration/kuberne
|
||||
sameSite: none
|
||||
maxAge: 42
|
||||
path: /foo
|
||||
domain: foo.com
|
||||
strategy: RoundRobin
|
||||
weight: 10
|
||||
nativeLB: true # [16]
|
||||
|
||||
@@ -391,6 +391,14 @@ which in turn will create the resulting routers, services, handlers, etc.
|
||||
traefik.ingress.kubernetes.io/service.sticky.cookie.samesite: "none"
|
||||
```
|
||||
|
||||
??? info "`traefik.ingress.kubernetes.io/service.sticky.cookie.domain`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
```yaml
|
||||
traefik.ingress.kubernetes.io/service.sticky.cookie.domain: "foo.com"
|
||||
```
|
||||
|
||||
??? info "`traefik.ingress.kubernetes.io/service.sticky.cookie.httponly`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
@@ -276,6 +276,14 @@ A Story of key & values
|
||||
|-----------------------------------------------------------------------|--------|
|
||||
| `traefik/http/services/myservice/loadbalancer/sticky/cookie/samesite` | `none` |
|
||||
|
||||
??? info "`traefik/http/services/<service_name>/loadbalancer/sticky/cookie/domain`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
| Key (Path) | Value |
|
||||
|-----------------------------------------------------------------------|-----------|
|
||||
| `traefik/http/services/myservice/loadbalancer/sticky/cookie/domain` | `foo.com` |
|
||||
|
||||
??? info "`traefik/http/services/<service_name>/loadbalancer/sticky/cookie/maxage`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
@@ -340,6 +348,12 @@ A Story of key & values
|
||||
|------------------------------------------------------------------------|--------|
|
||||
| `traefik/http/services/<service_name>/weighted/sticky/cookie/samesite` | `none` |
|
||||
|
||||
??? info "`traefik/http/services/<service_name>/weighted/sticky/cookie/domain`"
|
||||
|
||||
| Key (Path) | Value |
|
||||
|------------------------------------------------------------------------|-----------|
|
||||
| `traefik/http/services/<service_name>/weighted/sticky/cookie/domain` | `foo.com` |
|
||||
|
||||
??? info "`traefik/http/services/<service_name>/weighted/sticky/cookie/httpOnly`"
|
||||
|
||||
| Key (Path) | Value |
|
||||
|
||||
@@ -306,6 +306,14 @@ you'd add the tag `traefik.http.services.{name-of-your-choice}.loadbalancer.pass
|
||||
traefik.http.services.myservice.loadbalancer.sticky.cookie.samesite=none
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.domain`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
```yaml
|
||||
traefik.http.services.myservice.loadbalancer.sticky.cookie.domain=foo.com
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.maxage`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
@@ -451,6 +451,14 @@ you'd add the label `traefik.http.services.<name-of-your-choice>.loadbalancer.pa
|
||||
- "traefik.http.services.myservice.loadbalancer.sticky.cookie.samesite=none"
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.sticky.cookie.domain`"
|
||||
|
||||
See [sticky sessions](../services/index.md#sticky-sessions) for more information.
|
||||
|
||||
```yaml
|
||||
- "traefik.http.services.myservice.loadbalancer.sticky.cookie.domain=foo.com"
|
||||
```
|
||||
|
||||
??? info "`traefik.http.services.<service_name>.loadbalancer.responseforwarding.flushinterval`"
|
||||
|
||||
See [response forwarding](../services/index.md#response-forwarding) for more information.
|
||||
|
||||
@@ -255,6 +255,12 @@ On subsequent requests, to keep the session alive with the same server, the clie
|
||||
|
||||
`SameSite` can be `none`, `lax`, `strict` or empty.
|
||||
|
||||
!!! info "Domain"
|
||||
|
||||
The Domain attribute of a cookie specifies the domain for which the cookie is valid.
|
||||
|
||||
By setting the Domain attribute, the cookie can be shared across subdomains (for example, a cookie set for example.com would be accessible to www.example.com, api.example.com, etc.). This is particularly useful in cases where sticky sessions span multiple subdomains, ensuring that the session is maintained even when the client interacts with different parts of the infrastructure.
|
||||
|
||||
??? example "Adding Stickiness -- Using the [File Provider](../../providers/file.md)"
|
||||
|
||||
```yaml tab="YAML"
|
||||
@@ -286,6 +292,7 @@ On subsequent requests, to keep the session alive with the same server, the clie
|
||||
cookie:
|
||||
name: my_sticky_cookie_name
|
||||
secure: true
|
||||
domain: mysite.site
|
||||
httpOnly: true
|
||||
```
|
||||
|
||||
@@ -297,6 +304,7 @@ On subsequent requests, to keep the session alive with the same server, the clie
|
||||
name = "my_sticky_cookie_name"
|
||||
secure = true
|
||||
httpOnly = true
|
||||
domain = "mysite.site"
|
||||
sameSite = "none"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user