No description
Find a file
Abigail Pain 1286b14df4
All checks were successful
ci/woodpecker/push/buildAndPublish Pipeline was successful
Add command to Dockerfile
2025-08-30 18:14:20 +01:00
.woodpecker Update buildAndPublish.yml 2025-08-09 23:12:15 +01:00
Dockerfile Add command to Dockerfile 2025-08-30 18:14:20 +01:00
go.mod Add Dockerfile 2025-08-09 16:51:29 +01:00
LICENSE Initial commit 2025-08-09 12:51:15 +01:00
main.go slog.Warning -> slog.Warn 2025-08-11 00:59:01 +01:00
README.md Update README.md 2025-08-09 23:33:28 +01:00

mini-esi-proxy

A small proxy server that expands esi:include tags within HTML documents


This is a small proxy server that is designed, primarily, to add a little bit of interactivity to static websites. It accepts incoming requests on a HTTP port and forwards them to an upstream server like-for-like. The response is then conditionally checked for <esi:include> tags and returned to the client.

The response parsing is done based on the following rules:

  • If any of the following checks fail, return the entire response (including headers) as-is, without modification:
    • Is the response status code in the 2xx range?
    • Does the Content-Type header contain text/html?
    • Is the first character of the response body <?
  • Are there any <esi:include src="/path"> blocks in the response body?
    • Yes: expand those blocks using the entire response from $ESI_INCLUDES_URL/path, ignoring any other attributes, and removing the Etag and Last-Modified headers from the main response if they are set
    • No: return the entire response as-is, without modification

It is configured with the following environment variables:

  • ESI_HTTP_PORT: port to run the proxy's HTTP server on (default 5000)
  • ESI_HTTP_HOST: hostname to run the proxy's HTTP server on (default 0.0.0.0)
  • ESI_UPSTREAM_URL: the base URL to forward requests to
  • ESI_INCLUDES_URL: the base URL used for ESI requests
  • ESI_REQUEST_TIMEOUT_SECONDS: the timeout used for all requests made by the proxy (default 10 seconds)

Limitations

  • No caching
  • Very limited ESI support (ie. just <esi:include path="">)