{"id":16408494,"url":"https://github.com/tommoulard/htransformation","last_synced_at":"2025-04-06T05:17:20.087Z","repository":{"id":44300591,"uuid":"305628176","full_name":"tomMoulard/htransformation","owner":"tomMoulard","description":"A Traefik plugin to change on the fly header's value of a request","archived":false,"fork":false,"pushed_at":"2025-03-24T09:56:14.000Z","size":795,"stargazers_count":85,"open_issues_count":9,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-05T14:35:41.945Z","etag":null,"topics":["hackathon","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomMoulard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["tommoulard"],"custom":["https://www.paypal.me/tommoulard"]}},"created_at":"2020-10-20T07:40:13.000Z","updated_at":"2025-03-24T09:55:59.000Z","dependencies_parsed_at":"2024-01-14T17:16:48.261Z","dependency_job_id":"f48582d9-6e3f-49bf-8fea-1489311a2dd8","html_url":"https://github.com/tomMoulard/htransformation","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomMoulard%2Fhtransformation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomMoulard%2Fhtransformation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomMoulard%2Fhtransformation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomMoulard%2Fhtransformation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomMoulard","download_url":"https://codeload.github.com/tomMoulard/htransformation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247436289,"owners_count":20938533,"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":["hackathon","traefik","traefik-plugin"],"created_at":"2024-10-11T06:17:01.055Z","updated_at":"2025-04-06T05:17:20.065Z","avatar_url":"https://github.com/tomMoulard.png","language":"Go","funding_links":["https://github.com/sponsors/tommoulard","https://www.paypal.me/tommoulard"],"categories":[],"sub_categories":[],"readme":"# Header transformation plugin for traefik\n\nThis plugin allows changing on the fly, the header value of a request.\n\n## How to dev\n\n```bash\n$ docker compose up\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- 'Del'             : to Delete a header\n- 'Join'            : to Join values on a header\n- 'Rename'          : to rename a header\n- 'RewriteValueRule': to rewrite header values\n- 'Set'             : to Set a header\n\nEach Rule can be named with the `Name` field.\n\nEach Rule can also be configured to change headers on the request or the\nresponse by using the `SetOnResponse` configuration.\nIf `SetOnResponse` is set to `true`, the header will be changed on the response.\nOtherwise, it will be changed on the request.\nIts default value is `false`.\n\n### Rename\n\nA Rule Rename needs two arguments.\n\n- `Header`, the regex of the header you want to replace\n- `Value`, the new header\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)\n\nA rule Set need 2 arguments\n\n- `Header`, the header you want to create\n- `Value`, the value of the new header\n\n```yaml\n# Example \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### Delete\n\nA rule Delete need one arguments\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\n### Join\n\nA Join rule will concatenate the values of the existing header with the new one. If the header doesn't exist, it'll do nothing\n\nIt needs 3 arguments\n- `Header`, the header you want to join\n- `Values`, a list of values to add to the existing header\n- `Sep`, the separator you want to use\n\n```yaml\n# Example Join\n- Rule:\n      Name: 'Header join'\n      Header: 'Cache-Control'\n      Sep: ','\n      Values:\n        - 'Foo'\n        - 'Bar'\n      Type: 'Join'\n```\n\n```yaml\n# Old header:\nCache-Control: gzip, deflate\n\n# Joined header:\nCache-Control: gzip, deflate,Foo,Bar\n```\n\nYou can reuse other header values in `Value` or one of the `Values` by setting an additional argument `HeaderPrefix`.\nExample:\n\n```yaml\n# Example Usage\n- Rule:\n  Name: 'Header set'\n  Header: 'X-Forwarded-For'\n  HeaderPrefix: \"^\"\n  Sep: ','\n  Values:\n      - 'Foo'\n      - '^CF-Connecting-IP'\n  Type: 'Join'\n```\n\n```yaml\n# Old header:\nX-Forwarded-For: 1.1.1.1\nCF-Connecting-IP: 2.2.2.2\n# New headers:\nX-Forwarded-For: 1.1.1.1,Foo,2.2.2.2\nCF-Connecting-IP: 2.2.2.2\n```\n\n### RewriteValue Rule\n\nA RewriteValue Rule will replace the values of the headers identified by a matching regex with the provided value.\n\nIt needs 2 arguments\n\n- `Header`, the header or regex identifying the headers you want to change\n- `Value`, the new value of the headers\n\n```yaml\n# Example RewriteValueRule\n- Rule:\n      Name: 'Header rewriteValue'\n      Header: 'Foo'\n      Value: 'X-(.*)'\n      ValueReplace: 'Y-$1'\n      Type: 'RewriteValueRule'\n```\n\n```yaml\n# Old header:\nFoo: X-Test\n\n# Modified header:\nFoo: Y-Test\n```\n\n### Careful\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```\nWill set the header `X-Custom-2` to 'True', then delete it and set it again but with `False`\n\n# Authors\n\n| Tom Moulard | Clément David | Martin Huvelle | Alexandre Bossut-Lasry |\n|-------------|---------------|----------------|------------------------|\n|[![](img/gopher-tom_moulard.png)](https://tom.moulard.org)|[![](img/gopher-clement_david.png)](https://github.com/cledavid)|[![](img/gopher-martin_huvelle.png)](https://github.com/nitra-mfs)|[![](img/gopher-alexandre_bossut-lasry.png)](https://www.linkedin.com/in/alexandre-bossut-lasry/)|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommoulard%2Fhtransformation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommoulard%2Fhtransformation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommoulard%2Fhtransformation/lists"}