Skip to content

yosepkim/edgeworker-esihandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is ESI?

Edge Side Includes (ESI) is used for dynamically assembling HTML contents on the Edge (i.e. CDN). When a HTML page is requested, an ESI processor running on the Edge intercepts and looks for tags (e.g. <esi:include src='http://some.com/page' />, fetches the content from the src, then replace the ESI tag with the content.

EdgeWorker to the Rescue

If your codebase still uses ESI tags and has no longer access to the ESI handler, one can use Akamai EdgeWorker to enable the feature. This project demonstrates just that.

In the main.js, using regex, the code looks for <esi:include /> tags. The .exec() method returns a match at a time, which makes it ideal to handle each occurences.

The code is for educational purposes only. It does not have minimum tests and lacks error handling. Also, note that ESI specification has more than the includes, which the codebase does not address.

To run tests, execute the following:

$ node --experimental-vm-modules node_modules/.bin/jest

About

Handle ESI Includes using Akamai EdgeWorker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published