Skip to content

Commit 5433693

Browse files
authored
Create using-sse.md
1 parent 145a045 commit 5433693

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Using Server-Sent Events with Application Gateway (Preview)
3+
description: This article provides guidance for using Server-Sent Events with your Azure Application Gateway.
4+
services: application-gateway
5+
author: jaesoni
6+
ms.service: azure-application-gateway
7+
ms.topic: concept-article
8+
ms.date: 05/15/2025
9+
ms.author: jaysoni
10+
---
11+
12+
# Using Server-Sent Events with Application Gateway (Preview)
13+
14+
Azure Application Gateway offers support for Server-Sent Events (SSE). This document provides guidelines to ensure the seamless operation of this feature when used with Azure Application Gateway.
15+
16+
> [!Note]
17+
> - The SSE support with Azure Application Gateway is currently in Preview phase.
18+
> - The response time recorded in [Access logs](monitor-application-gateway-reference.md#resource-logs) represents the total duration for which the connection was established. Multiple event streams may pass through during this connection period.
19+
20+
## Configuring Application Gateway
21+
22+
### Response Buffer
23+
24+
The [Response Buffers on Application Gateway resource](proxy-buffers.md) should be disabled. This configuration enables your application gateway resource to send responses to clients as streams from the backend server are received.
25+
26+
### Backend Setting - Request timeout
27+
28+
Ensure that the [Request time-out (seconds) in Backend Settings](configuration-http-settings.md?tabs=backendhttpsettings#request-timeout) is configured to exceed the idle time between events. Otherwise, your application gateway resource will terminate the connection prematurely.
29+
30+
31+
## Configuring backend server
32+
33+
The backend server should send the following Response headers to ensure proper stream handling by the clients and any intermediaries. Note, these headers are not a requirement for Application Gateway as a proxy.
34+
35+
### Content-Type: text/event-stream
36+
This header notifies the client that the response will be a stream of events, enabling them to correctly handle the Server-Sent Events (SSE) protocol.
37+
38+
### Connection: keep-alive
39+
This header maintains the TCP connection, allowing the backend server to send events to the client continuously.
40+
41+
### Transfer-Encoding: chunked
42+
This header allows the server to send responses in chunks without requiring a Content-Length header. It is necessary for streaming responses through SSE when the total size cannot be determined in advance.
43+
44+
### Cache-Control: no-cache
45+
It is generally advisable to use this header to prevent intermediaries like CDNs from caching the SSE response.
46+
47+
## Next steps
48+
Learn about [Request and Response Proxy Buffers](proxy-buffers.md) in Application Gateway.

0 commit comments

Comments
 (0)