{"id":15323081,"url":"https://github.com/darkweak/go-esi","last_synced_at":"2025-06-17T19:37:48.023Z","repository":{"id":59005179,"uuid":"533069528","full_name":"darkweak/go-esi","owner":"darkweak","description":"Pure implementation of the non-standard ESI (Edge-Side-Include) specification in Go","archived":false,"fork":false,"pushed_at":"2023-03-23T09:12:23.000Z","size":14261,"stargazers_count":24,"open_issues_count":3,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T02:45:17.967Z","etag":null,"topics":["caddy-module","esi","esi-tags","traefik-plugin"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darkweak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-09-05T21:46:02.000Z","updated_at":"2025-03-21T09:12:50.000Z","dependencies_parsed_at":"2023-09-24T17:59:09.217Z","dependency_job_id":"d2134a68-6be9-4856-8bc2-5874b6d1fcd4","html_url":"https://github.com/darkweak/go-esi","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"dfdfaa8466f9c7cc840040aeb753ee0887c0d431"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/darkweak/go-esi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkweak%2Fgo-esi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkweak%2Fgo-esi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkweak%2Fgo-esi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkweak%2Fgo-esi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darkweak","download_url":"https://codeload.github.com/darkweak/go-esi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkweak%2Fgo-esi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260427398,"owners_count":23007503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caddy-module","esi","esi-tags","traefik-plugin"],"created_at":"2024-10-01T09:18:56.547Z","updated_at":"2025-06-17T19:37:43.012Z","avatar_url":"https://github.com/darkweak.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-esi\n------\n\ngo-esi is the implementation of the non-standard ESI (Edge-Side-Include) specification from the w3. With that you'll be able to use the ESI tags and process them in your favorite golang servers.\n\n## What are the ESI tags\nThe ESI tags were introduced by Akamai to add some dynamic tags and only re-render these parts on the server-side.\nThe goal of that is to render only specific parts. For example, we want to render a full e-commerce webpage but only the cart is user-dependent. So we could render the \"static\" parts and store with a predefined TTL (e.g. 60 minutes), and only the cart would be requested to render the block.\n\nThere are multiple `esi` tags that we can use but the most used is the `esi:include` because that's the one to request another resource.\n\nWe can have many `esi:include` tags in a single response, and each `esi:include` tags can itself have one or more `esi:include` tags.\n\n![esi page example](https://github.com/darkweak/go-esi/blob/master/docs/esi_2.jpg?sanitize=true)\n\nWe can have multiple `esi:include` tags in the page to request another resource and add its content to the main page.\n\n![esi process example](https://github.com/darkweak/go-esi/blob/master/docs/esi_1.jpg?sanitize=true)\n\n## References\nhttps://www.w3.org/TR/esi-lang/\n\n## Install\n```bash\ngo get -u github.com/darkweak/go-esi\n```\n\n## Usage\n```go\nimport (\n    // ...\n    github.com/darkweak/go-esi/esi\n)\n\n//...\n\nfunc functionToParseESITags(b []byte, r *http.Request) []byte {\n    // Returns the parsed response.\n    res := esi.Parse(b, r)\n\n    //...\n    return res\n}\n```\n\n## Available as middleware\n- [x] Caddy\n- [x] Træfik\n- [x] Roadrunner\n\n### Caddy middleware\n```bash\nxcaddy build --with github.com/darkweak/go-esi/middleware/caddy\n```\nRefer to the [sample Caddyfile](https://github.com/darkweak/go-esi/blob/master/middleware/caddy/Caddyfile) to know how to use that.\n\n### Roadrunner middleware\nTo use the `go-esi` processor as Roadrunner middleware, you just have to follow the steps below.  \nYou have to build your `rr` binary with the `go-esi` dependency.\n```toml\n[velox]\nbuild_args = ['-trimpath', '-ldflags', '-s -X github.com/roadrunner-server/roadrunner/v2/internal/meta.version=v2.12.0 -X github.com/roadrunner-server/roadrunner/v2/internal/meta.buildTime=10:00:00']\n\n[roadrunner]\nref = \"v2.12.3\"\n\n[github]\n    [github.token]\n    token = \"GH_TOKEN\"\n\n    [github.plugins]\n    logger = { ref = \"v3.2.0\", owner = \"roadrunner-server\", repository = \"logger\" }\n    esi = { ref = \"master\", owner = \"darkweak\", repository = \"go-esi\", folder = \"middleware/roadrunner\", replace = \"/opt/middleware/roadrunner\" }\n    server = { ref = \"v3.2.0\", owner = \"roadrunner-server\", repository = \"server\" }\n    gzip = { ref = \"v3.2.0\", owner = \"roadrunner-server\", repository = \"gzip\" }\n    http = { ref = \"v3.2.0\", owner = \"roadrunner-server\", repository = \"http\" }\n\n[log]\nlevel = \"debug\"\nmode = \"development\"\n```\n\nAfter that, you'll be able to set enable and add the esi processor to the middleware chain.\n```yaml\n# .rr.yaml\nhttp:\n  # Other http sub keys\n  esi: {}\n  middleware:\n    - headers\n    - gzip\n    - esi\n```\n\n### Træfik middleware\n```yaml\n# anywhere/traefik.yml\nexperimental:\n  plugins:\n    souin:\n      moduleName: github.com/darkweak/go-esi\n      version: v0.0.6\n```\n```yaml\n# anywhere/dynamic-configuration\nhttp:\n  routers:\n    whoami:\n      middlewares:\n        - esi\n      service: whoami\n      rule: Host(`domain.com`)\n  middlewares:\n    esi:\n      plugin:\n        esi: {}\n```\nRefer to the [sample traefik file](https://github.com/darkweak/go-esi/blob/master/middleware/traefik/esi-configuration.yml) to know how to use that.\n\n## TODO\n- [x] choose tag\n- [x] comment tag\n- [x] escape tag\n- [x] include tag\n- [x] remove tag\n- [x] otherwise tag\n- [ ] try tag\n- [x] vars tag\n- [x] when tag","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkweak%2Fgo-esi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarkweak%2Fgo-esi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkweak%2Fgo-esi/lists"}