NashTech Blog

Enable Cookie based affinity with an Application Gateway

Table of Contents
fiber optic, cable, blue-2749588.jpg

 

Application Gateway offers support for cookie-based affinity, allowing it to route subsequent traffic from a user session to the same server for processing.

What is Application Gateway ?

An Application Gateway is a load balancer service in Azure that provides advanced traffic management capabilities to your web applications. It works at the application layer (Layer 7) of the OSI model, allowing you to control and route traffic based on various criteria, such as URL path or host headers.

Application Gateway can provide features like SSL termination, cookie-based session affinity, URL-based routing, and web application firewall (WAF) protection. You can use it to improve the performance, scalability, and security of web applications deployed in Azure.

What is cookie based affinity ?

When a user initially accesses a service behind the Application Gateway, the gateway assigns a unique identifier (a cookie) to that user’s session. For subsequent requests from the same user, the gateway uses this cookie to ensure that the requests are routed to the same backend server that handled the initial request. This helps maintain session state and can be useful for scenarios where stateful operations need to be performed across multiple requests from the same user.

If you want to enable cookie based affinity with application gateway using application gateway ingress controller you can use following annotation :

appgw.ingress.kubernetes.io/cookie-based-affinity: “true”

An example configuration to show how to use it in ingress file :

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: guestbook
annotations:
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/cookie-based-affinity: “true”
spec:
rules:
– http:
paths:
–  backend:
serviceName: frontend
servicePort: 80

I hope this will help you . For more such blogs keep exploring nashtech blogs .

Picture of Saumya

Saumya

Leave a Comment

Suggested Article

Discover more from NashTech Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading