{"id":34147271,"url":"https://github.com/tuxgal/traefik_inline_response","last_synced_at":"2026-03-11T07:01:15.184Z","repository":{"id":260377559,"uuid":"881096177","full_name":"tuxgal/traefik_inline_response","owner":"tuxgal","description":"A highly configurable Traefik middleware plugin that can be used to return a response inline based on the configuration without any backend / service.","archived":false,"fork":false,"pushed_at":"2026-01-11T02:59:20.000Z","size":733,"stargazers_count":4,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-11T10:24:25.858Z","etag":null,"topics":["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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuxgal.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-30T22:46:56.000Z","updated_at":"2026-01-11T02:59:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"c1ff68c5-bfaa-405b-9683-a7a7c5371bef","html_url":"https://github.com/tuxgal/traefik_inline_response","commit_stats":null,"previous_names":["tuxgal/traefik_inline_response"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tuxgal/traefik_inline_response","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuxgal%2Ftraefik_inline_response","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuxgal%2Ftraefik_inline_response/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuxgal%2Ftraefik_inline_response/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuxgal%2Ftraefik_inline_response/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuxgal","download_url":"https://codeload.github.com/tuxgal/traefik_inline_response/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuxgal%2Ftraefik_inline_response/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["traefik-plugin"],"created_at":"2025-12-15T04:20:22.785Z","updated_at":"2026-03-11T07:01:15.178Z","avatar_url":"https://github.com/tuxgal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Traefik Inline Response Plugin\n\n[![Build](https://github.com/tuxgal/traefik_inline_response/actions/workflows/build.yml/badge.svg)](https://github.com/tuxgal/traefik_inline_response/actions/workflows/build.yml) [![Tests](https://github.com/tuxgal/traefik_inline_response/actions/workflows/tests.yml/badge.svg)](https://github.com/tuxgal/traefik_inline_response/actions/workflows/tests.yml) [![Lint](https://github.com/tuxgal/traefik_inline_response/actions/workflows/lint.yml/badge.svg)](https://github.com/tuxgal/traefik_inline_response/actions/workflows/lint.yml) [![CodeQL](https://github.com/tuxgal/traefik_inline_response/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/tuxgal/traefik_inline_response/actions/workflows/codeql-analysis.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/tuxgal/traefik_inline_response)](https://goreportcard.com/report/github.com/tuxgal/traefik_inline_response)\n\nA Traefik middleware plugin for responding to requests inline without\na backend.\n\nThis allows you to make Traefik act as a request handler with a\ncustom set of rules that can be configured and without the need for a\nbackend.\n\nThe responses to the requests are configurable based on the path of the\nrequest. The response status code and the body are also configurable.\nResponses can be static or dynamic based on the specified template.\n\n## Usage\n\nThe [Traefik plugins doc](https://plugins.traefik.io/install) can be used\nas the general reference for installing the plugin.\n\n1. Add the plugin to traefik's static configuration:\n\n```yaml\nexperimental:\n  plugins:\n    inlineResponse:\n      moduleName: github.com/tuxgal/traefik_inline_response\n      version: v0.1.2\n\n```\n\n2. Configure the plugin as part of the middleware definition in the\ndynamic configuration:\n\n```yaml\nhttp:\n  routers:\n    to-local-backend:\n      rule: 'HostRegexp(`^.*$`)'\n      service: local-backend\n      middlewares:\n        - inline-response\n  middlewares:\n    inline-response:\n      plugin:\n        inlineResponse:\n          matchers:\n            - path:\n                abs: /path1\n              statusCode: 200\n              response:\n                raw: Hello from /path1\n            - path:\n                prefix: /path2\n              statusCode: 200\n              response:\n                json:\n                  name: traefik\n                  category: plugin\n                  health:\n                    frontend: ok\n                    middleware: ok\n                    backend: ok\n            - path:\n                regex: '^.*/path3/foo/.*$'\n              statusCode: 403\n              response:\n                template: '{{ .Method }}-{{ .URL.Scheme }}-{{ .URL.Host }}-{{ .URL.Path }}'\n            - path:\n                regex: '^/path4/.+$'\n              statusCode: 405\n          fallback:\n            statusCode: 404\n            response:\n              template: '{{ .Proto }} {{ .URL.Path }} Not Found'\n  services:\n    local-backend:\n      loadBalancer:\n        servers:\n          - url: noop@internal\n```\n\nNote, how we configure the router to send the request to a service whose\nbackend is `noop@internal` a special no-op traefik backend. When the plugin\nis able to match and respond to the requests, the requests do not reach\nthis special backend at all.\n\nIn the above example, the middleware will respond to the requests based\non the following rules in order without the need for any backend service:\n\n1. Any request paths matching the absolute path `/path1` will return a\n   response with `200` status code and body `Hello from /path1`.\n\n2. Any request paths with the prefix `/path2` will return a response with\n   `200` status code and the JSON:\n\n```json\n{\n  \"name\": \"traefik\",\n  \"category\": \"plugin\",\n  \"health\": {\n    \"frontend\": \"ok\",\n    \"middleware\": \"ok\",\n    \"backend\": \"ok\"\n  }\n}\n```\n\n3. Any request paths matching the regular expression `^.*/path3/foo/.*$` will\n   return a response with `403` status code and body whose result will be\n   the evaluation of the go template `{{ .Method }}-{{ .URL.Scheme }}-{{ .URL.Host }}-{{ .URL.Path }}`\n   with the input to the template being the\n   [`Request` type from `net/http` package](https://pkg.go.dev/net/http#Request).\n\n4. Any request paths matching the regular expression `^/path4/.+$` will\n   return an empty response body with status code `405`.\n\n5. Requests not matching any of the above rules will be handled as per the\n   configuration defined under `fallback`. In this case, it will lead to\n   a response with status code `404` with the body whose result will be\n   the evaluation of the go template `{{ .Proto }} {{ .URL.Path }} Not Found`\n   with the input to the template being the\n   [`Request` type from `net/http` package](https://pkg.go.dev/net/http#Request).\n\n## Configuration Details\n\n- Every configuration includes a list of path matcher handlers which are\n  evaluated in the order defined and an optional fallback handler if the\n  request did not match any of the rules specified in the path matcher\n  handlers.\n- Path matcher handlers are optional.\n- Each matcher can match against the request path based on exactly one of\n  absolute path, path prefix or a regular expression.\n- Response status code is mandatory.\n- Response body is optional.\n- Response body if specified, can be one of static string, JSON or a go\n  template that is evaluated with the request as the input to the template.\n- Fallback handler is optional.\n- Fallback handler if specified, has the same rules and constraints as\n  the response handling configuration specified under a matcher.\n- Fallback handler if specified will only handle the request if none of\n  the path matcher handlers are able to match the request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuxgal%2Ftraefik_inline_response","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuxgal%2Ftraefik_inline_response","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuxgal%2Ftraefik_inline_response/lists"}