# Session Persistence Type of document: How-to guide Product: F5 NGINX Gateway Fabric > Configure session persistence so related client requests reach the same backend pod. --- Learn how to configure session persistence using NGINX Gateway Fabric. ## Overview In this guide, you’ll learn how to configure session persistence for your application. Session persistence ensures that multiple requests from the same client are consistently routed to the same backend Pod. This is useful when your application maintains in-memory state (for example, shopping carts or user sessions). NGINX Gateway Fabric supports cookie-based session persistence for both NGINX Open Source and NGINX Plus, configured using the `sessionPersistence` field directly on `HTTPRoute` and `GRPCRoute` resources. In this guide, you will deploy two applications: - An application configured with cookie-based session persistence. - A regular application with default load-balancing. These applications will showcase the benefits of session persistence for stateful workloads. The NGINX directive discussed in this guide is [`sticky cookie`](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#sticky). ## Note **Note:** Session Persistence is a Gateway API field from the experimental release channel and is subject to change. **Note:** The experimental `sessionPersistence` field on `HTTPRouteRule` and `GRPCRouteRule` is deprecated. [GEP-1619](https://gateway-api.sigs.k8s.io/geps/gep-1619/#deprecated-route-inline-and-backendtrafficpolicy-session-persistence) moves session persistence configuration to the [`Backend`](https://gateway-api.sigs.k8s.io/geps/gep-4894/) resource, and the route-level field will be removed once `Backend` session persistence reaches the Standard channel. Expect to migrate your routes to the new API in a future release. ## Before you begin [Install](/ngf/install/nginx-plus.md) NGINX Gateway Fabric with experimental features enabled. To use Gateway API experimental resources, the Gateway API resources from the experimental channel must be installed before deploying NGINX Gateway Fabric. Additionally, NGINX Gateway Fabric must have experimental features enabled. **Note:** As noted in the [Gateway API documentation](https://gateway-api.sigs.k8s.io/guides/#install-experimental-channel), future releases of the Gateway API can include breaking changes to experimental resources and fields. To install the Gateway API resources from the experimental channel, run the following: ```shell kubectl kustomize "https://github.com/nginx/nginx-gateway-fabric/config/crd/gateway-api/experimental?ref=v" | kubectl apply -f - ``` **Note:** If you plan to use the `edge` version of NGINX Gateway Fabric, you can replace the version in `ref` with `main`, for example `ref=main`. To enable experimental features on NGINX Gateway Fabric: Using Helm: Set `nginxGateway.gwAPIExperimentalFeatures.enable` to true. An example can be found in the [Installation with Helm](/ngf/install/helm.md#custom-installation-options) guide. Using Kubernetes manifests: Add the `--gateway-api-experimental-features` command-line flag to the deployment manifest args. An example can be found in the [Installation with Kubernetes manifests](/ngf/install/manifests.md#3-deploy-nginx-gateway-fabric) guide. ## Setup Create the `tea` and `latte` applications: ```yaml kubectl apply -f - < pod/latte-d5f64f67f-drwc6 1/1 Running 0 3h19m 10.244.0.98 kind-control-plane pod/tea-859766c68c-cnb8n 1/1 Running 0 3h19m 10.244.0.93 kind-control-plane pod/tea-859766c68c-kttkb 1/1 Running 0 3h19m 10.244.0.97 kind-control-plane NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR service/latte ClusterIP 10.96.42.39 80/TCP 3h19m app=latte service/tea ClusterIP 10.96.81.103 80/TCP 3h19m app=tea ``` Create a Gateway: ```yaml kubectl apply -f - < ``` Replace `` with the port number you use to access your Gateway. **Note:** In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for. ## Configure cookie-based session persistence You can configure session persistence by specifying the `sessionPersistence` field on an `HTTPRouteRule` or `GRPCRouteRule`. This configuration is translated to the `sticky cookie` directive on the NGINX data plane. In this guide, you’ll create a `tea` HTTPRoute with `sessionPersistence` configured at the rule level and then verify how traffic behaves when the route has multiple backend Pods. ```yaml kubectl apply -f - <