No description
All checks were successful
ci/woodpecker/push/buildAndPublish Pipeline was successful
|
||
---|---|---|
.woodpecker | ||
Dockerfile | ||
go.mod | ||
LICENSE | ||
main.go | ||
README.md |
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 containtext/html
? - Is the first character of the response body
<
?
- Is the response status code in the
- 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 theEtag
andLast-Modified
headers from the main response if they are set - No: return the entire response as-is, without modification
- Yes: expand those blocks using the entire response from
It is configured with the following environment variables:
ESI_HTTP_PORT
: port to run the proxy's HTTP server on (default5000
)ESI_HTTP_HOST
: hostname to run the proxy's HTTP server on (default0.0.0.0
)ESI_UPSTREAM_URL
: the base URL to forward requests toESI_INCLUDES_URL
: the base URL used for ESI requestsESI_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="">
)