{"id":22066019,"url":"https://github.com/adyanth/header-transform","last_synced_at":"2025-07-10T00:36:07.396Z","repository":{"id":47758414,"uuid":"384082792","full_name":"adyanth/header-transform","owner":"adyanth","description":"Traefik plugin on header transformations","archived":false,"fork":false,"pushed_at":"2021-08-14T16:19:26.000Z","size":544,"stargazers_count":6,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-03T07:25:25.856Z","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/adyanth.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}},"created_at":"2021-07-08T10:10:51.000Z","updated_at":"2024-10-26T23:52:09.000Z","dependencies_parsed_at":"2022-09-12T23:22:55.822Z","dependency_job_id":null,"html_url":"https://github.com/adyanth/header-transform","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/adyanth/header-transform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adyanth%2Fheader-transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adyanth%2Fheader-transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adyanth%2Fheader-transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adyanth%2Fheader-transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adyanth","download_url":"https://codeload.github.com/adyanth/header-transform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adyanth%2Fheader-transform/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264506246,"owners_count":23619003,"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":["traefik","traefik-plugin"],"created_at":"2024-11-30T19:23:16.382Z","updated_at":"2025-07-10T00:36:07.357Z","avatar_url":"https://github.com/adyanth.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Header transformation plugin for Traefik\n\n[![Build Status](https://travis-ci.com/adyanth/header-transform.svg?branch=main)](https://travis-ci.com/adyanth/header-transform)\n\nThis plugin allows to change, on the fly, the header's value of a request.\n\n## Dev `traefik.yml` configuration file for traefik\n\n```yml\npilot:\n  token: [REDACTED]\n\nexperimental:\n  devPlugin:\n    goPath: /home/tm/go\n    moduleName: github.com/adyanth/header-transform\n\nentryPoints:\n  http:\n    address: \":8000\"\n    forwardedHeaders:\n      insecure: true\n\napi:\n  dashboard: true\n  insecure: true\n\nproviders:\n  file:\n    filename: rules-header-transform.yaml\n```\n\n## How to dev\n\n```bash\n$ docker run -d --network host containous/whoami -port 5000\n# traefik --config-file traefik.yml\n```\n\n## How to use\n\nTo choose a Rule you have to fill the `Type` field with one of the following:\n\n- 'Rename'  : to rename a header\n- 'Set'     : to Set a header\n- 'Del'     : to Delete a header\n\nEach Rule can be named with the `Name` field\nEach Rule can be set to run only if the previous hop IP address belongs to a trusted range of IPs. Set this using the optional `TrustedCIDR`.\n\n```yaml\n# Example\n- Rule:\n      Name: 'Test'\n      ...\n      TrustedCIDR:\n        - 10.0.0.0/8\n        - 172.16.0.0/12\n        - 192.168.0.0/16\n```\n\n### Rename\n\nA Rule Rename needs two arguments and optionally the third.\n\n- `Header`, the regex of the header you want to replace\n- `Value`, the new header\n- `HeaderPrefix`, the prefix to denote the new Header name is to be taken from another header value\n\n```yaml\n# Example Rename\n- Rule:\n      Name: 'Header rename'\n      Header: 'Cache-Control'\n      Value: 'NewHeader'\n      Type: 'Rename'\n```\n\n```yaml\n# Old header:\nCache-Control: gzip, deflate\n\n# New header:\nNewHeader: gzip, deflate\n```\n\n``` yaml\n- Rule:\n      Name: 'Header Renaming'\n      Header: 'X-Traefik-*'\n      Value: 'X-Traefik-merged'\n      Type: 'Rename'\n```\n\n```yaml\n# Old header:\nX-Traefik-uuid: 0\nX-Traefik-date: mer. 21 oct. 2020 11:57:39 CEST\n# New header:\nX-Traefik-merged: 0 # A value from old headers\n```\n\n### Set\n\nA Set rule will either create or replace the header and value (if it already exists), appending multiple values with the separator if specified.\n\nA Rule Set needs the first two arguments, and optionally the next three.\n`Value` can be skipped if specifying `Values`.\n\n- `Header`, the header you want to create\n- `Value`, the value of the new header\n- `Values`, a list of values to add\n- `Sep`, the separator you want to use\n- `HeaderPrefix`, the prefix to denote the Value is to be taken from another header\n\n```yaml\n# Example Set\n- Rule:\n      Name: 'Set Cache-Control'\n      Header: 'Cache-Control'\n      Value: 'Foo'\n      Type: 'Set'\n```\n\n```yaml\n# New header:\nCache-Control: Foo\n```\n\n```yaml\n# Example Usage\n- Rule:\n  Name: 'Header set'\n  Header: 'X-Forwarded-For'\n  Value: '^CF-Connecting-IP'\n  HeaderPrefix: \"^\"\n  Type: 'Set'\n```\n\n```yaml\n# Old header:\nCF-Connecting-IP: 1.1.1.1\n\n# New headers:\nCF-Connecting-IP: 1.1.1.1\nX-Forwarded-For: 1.1.1.1\n```\n\n```yaml\n# Example Usage\n- Rule:\n  Name: 'Header XFF'\n  Header: 'X-Forwarded-For'\n  Value: '^CF-Connecting-IP'\n  Values:\n    - '^X-Forwarded-For'\n    - '192.168.0.1'\n  Sep: ', '\n  HeaderPrefix: \"^\"\n  Type: 'Set'\n```\n\n```yaml\n# Old header:\nCF-Connecting-IP: 1.1.1.1\nX-Forwarded-For: 10.0.0.1, 10.10.10.1\n# New headers:\nCF-Connecting-IP: 1.1.1.1\nX-Forwarded-For: 1.1.1.1, 10.0.0.1, 10.10.10.1, 192.168.0.1\n```\n\n```yaml\n# Example Join\n- Rule:\n      Name: 'Header join'\n      Header: 'Cache-Control'\n      Sep: ','\n      HeaderPrefix: \"^\"\n      Values:\n        - '^Cache-Control'\n        - 'Foo'\n        - 'Bar'\n      Type: 'Set'\n```\n\n```yaml\n# Old header:\nCache-Control: gzip, deflate\n\n# Joined header:\nCache-Control: gzip, deflate,Foo,Bar\n```\n\n### Delete\n\nA Rule Delete needs only one argument\n\n- `Header`, the header you want to delete\n\n```yaml\n# Example Del\n- Rule:\n      Name: 'Delete Cache-Control'\n      Header: 'Cache-Control'\n      Type: 'Del'\n```\n\n### Point to note\n\nThe rules will be evaluated in the order of definition\n\n```yaml\n#Example\n- Rule:\n  Name: 'Header addition'\n  Header: 'X-Custom-2'\n  Value: 'True'\n  Type: 'Set'\n- Rule:\n  Name: 'Header deletion'\n  Header: 'X-Custom-2'\n  Type: 'Del'\n- Rule:\n  Name: 'Header join'\n  Header: 'X-Custom-2'\n  Value: 'False'\n  Type: 'Set'\n```\n\nThis will firstly set the header `X-Custom-2` to 'True', then delete it and finally set it again but with `False`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadyanth%2Fheader-transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadyanth%2Fheader-transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadyanth%2Fheader-transform/lists"}