{"id":34675994,"url":"https://github.com/kodeart/traefik-plugin-setheaderfrom","last_synced_at":"2026-05-26T22:03:57.576Z","repository":{"id":328473843,"uuid":"1115682720","full_name":"kodeart/traefik-plugin-setheaderfrom","owner":"kodeart","description":"A traefik middleware plugin that creates or overwrites a request header using a value from another header.","archived":false,"fork":false,"pushed_at":"2025-12-13T13:42:10.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-22T20:37:48.008Z","etag":null,"topics":["traefik","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kodeart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-12-13T10:40:16.000Z","updated_at":"2025-12-13T13:40:58.000Z","dependencies_parsed_at":"2025-12-15T01:01:28.308Z","dependency_job_id":null,"html_url":"https://github.com/kodeart/traefik-plugin-setheaderfrom","commit_stats":null,"previous_names":["kodeart/traefik-plugin-setheaderfrom"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kodeart/traefik-plugin-setheaderfrom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodeart%2Ftraefik-plugin-setheaderfrom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodeart%2Ftraefik-plugin-setheaderfrom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodeart%2Ftraefik-plugin-setheaderfrom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodeart%2Ftraefik-plugin-setheaderfrom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodeart","download_url":"https://codeload.github.com/kodeart/traefik-plugin-setheaderfrom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodeart%2Ftraefik-plugin-setheaderfrom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33540629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","traefik-plugin"],"created_at":"2025-12-24T20:34:52.860Z","updated_at":"2026-05-26T22:03:57.534Z","avatar_url":"https://github.com/kodeart.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Set Header From Header\n\nA Traefik **middleware** plugin that **creates (or overwrites) \na request header** using a value extracted from another request \nheader via a regular expression capture group.\n\nTypical use case: derive `X-Subdomain` from `Host` \n(e.g., `foo.example.com` → `X-Subdomain: foo`).\n\n---\n\n## What it does\n\nGiven:\n\n- `regex`: a regular expression applied to the source header value\n- `source`: the **source** request header name (e.g., `Host`)\n- `destination`: the **destination** request header name to set (e.g., `X-Subdomain`)\n- `prefix`: optional string to prepend to the captured value\n- `suffix`: optional string to append to the captured value\n\nIf the source header exists and `regex` matches with at least one capture group, the middleware sets:\n\n- `create = prefix + \u003cfirst capture group\u003e + suffix`\n\nIf there is **no match**, the destination header is **not created**.\n\n---\n\n## Configuration\n\n### Fields\n\n| Field         | Type   | Required | Description                                                                                          |\n|---------------|--------|----------|------------------------------------------------------------------------------------------------------|\n| `regex`       | string | yes      | Regex used to match the source header value. Must include a capture group (the plugin uses group 1). |\n| `source`      | string | yes      | Source request header to read from.                                                                  |\n| `destination` | string | yes      | Destination request header name to set.                                                              |\n| `prefix`      | string | no       | Prepended to the captured value before setting the destination header.                               |\n| `suffix`      | string | no       | Appended to the captured value after setting the destination header.                                 |\n\n### Notes\n\n- Only the **first** capture group is used (group 1).\n- If the regex cannot be compiled, the plugin initialization fails and Traefik will refuse to load the middleware.\n- Header names are treated as HTTP header keys (e.g., `X-Foo`, `Host`).\n\n---\n## Example Configuration\n\nFor each plugin, the Traefik static configuration must define the module name.\n\nThe following declaration defines a plugin:\n\n### Static configuration\n```yaml\nexperimental:\n  plugins:\n    setheaderfrom:\n      moduleName: github.com/kodeart/traefik-plugin-setheaderfrom\n      version: v1.0.0-beta.2\n```\n\u003e Use the latest **version** (v1.0.0-beta.1 is an example).\n\n### Dynamic configuration\n```yaml\nhttp:\n  middlewares:\n    set-header-from:\n      plugin:\n        setheaderfrom:\n          regex: '^(.+)\\.example\\.com$'\n          source: Host\n          destination: X-Subdomain\n          prefix: '' # optional\n          suffix: '' # optional\n```\n\nAttach it to a router/service as you normally would:\n```yaml\nhttp:\n  routers:\n    app:\n      rule: Host(`test.example.com`)\n      service: app-svc\n      middlewares:\n        - set-header-from\n\n  services:\n    app-svc:\n      loadBalancer:\n        servers:\n          - url: http://127.0.0.1\n```\n---\n\n### Docker labels\n```yaml\nservices:\n  whoami:\n    image: traefik/whoami\n    labels:\n      - traefik.enable=true\n      - traefik.http.routers.whoami.rule=Host(`test.example.com`)\n      - traefik.http.routers.whoami.middlewares=set-header-from@file\n```\n(Using `@file` assumes you configured the middleware \nvia the file provider. You can also configure plugins \nvia other providers depending on your setup.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodeart%2Ftraefik-plugin-setheaderfrom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodeart%2Ftraefik-plugin-setheaderfrom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodeart%2Ftraefik-plugin-setheaderfrom/lists"}