ESI (Edge Side Includes)
Demonstrates Fastly's ESI functionality with parent-child HTML fragment assembly at the edge.
/fastly_features/esi
📋 Description
Edge Side Includes allows assembling web pages from fragments at the edge. This endpoint serves a parent HTML file containing ESI tags that Fastly processes to inject child content.
Internally redirects to /html/parent_esi.html.
⚙️ How ESI Works
Client Request → Fastly Edge
↓
1. Serves parent_esi.html
2. Detects <esi:include> tags
3. Fetches child_esi.html
4. Assembles final HTML
↓
Complete HTML Response
📄 ESI Files
-
parent_esi.html
Contains ESI include tags • Cache-Control:private, no-store -
child_esi.html
Content to be included • Cache-Control:private, no-store
💡 Usage Examples
Test ESI processing:
curl https://your-service.edgecompute.app/fastly_features/esi
View parent file directly:
curl https://your-service.edgecompute.app/html/parent_esi.html
View child file directly:
curl https://your-service.edgecompute.app/html/child_esi.html
🏷️ ESI Tag Syntax
In the parent HTML file:
<esi:include src="/html/child_esi.html" />
📄 Expected Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: private, no-store [HTML with child content injected]
Note: ESI processing must be enabled in your Fastly service configuration. Both files use Cache-Control: private, no-store to ensure fresh processing on each request.