Skip to content

Dynamic Edge Side Includes (ESI) using Varnish and Traefik

License

Notifications You must be signed in to change notification settings

dfelski/docker-esi-traefik-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Edge Side Includes using Varnish and Traefik

Edge Side Includes (ESI) with Varnish work basically like a charm. But if you want to dynamically add new backends the things became much more complicated. Traefik as reverse proxy can help here.

Traefik is able to monitor docker services and allows to update the configuration automatically without a restart. In this example the Vernish Cache is configured as an entry point with only one backend, the Traefik reverse proxy. All docker services register themselves using traefik.frontend.rule labels dynamically. You can add new services without any additional configuration.

We'll use two options of Traefik, defining a path mapping for frontend a and adding a hostname for frontend b.

Test it

Let's start the reverse_proxy and vernish containers first:

docker-compose start varnish reverse-proxy

A HTTP GET request to http://localhost/a or http://b.localhost should lead to a 404 error and that's fine for now.

So let's bring the first front end service up

docker-compose start frontend-a

While http://b.localhost remains not available a GET request to http://localhost/a URL should return some content now. Some parts are still missing, so let's start the last service

docker-compose start frontend-b

Now both side should be available and complete.

About

Dynamic Edge Side Includes (ESI) using Varnish and Traefik

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published