tomMoulard / htransformation

A Traefik plugin to change on the fly header's value of a request
MIT License
81 stars 13 forks source link

Error in Readme ? #38

Open mysther opened 1 year ago

mysther commented 1 year ago

Hello, in readme file you have the following example :

#Example
- Rule:
  Name: 'Header addition'
  Header: 'X-Custom-2'
  Value: 'True'
  Type: 'Set'
- Rule:
  Name: 'Header deletion'
  Header: 'X-Custom-2'
  Type: 'Del'
- Rule:
  Name: 'Header join'
  Header: 'X-Custom-2'
  Value: 'False'
  Type: 'Set'

But in doesn't work at all ...

The following code works :

Rules:
  - Name: "Rewrite to http"
    Type: "RewriteValueRule"
    Header: "Destination"
    Value: "https://(.*)"
    ValueReplace: "http://$1"

Am I the only one in this case? Am I missing something?

I searched for four hours why I couldn't get the plugin to work due to this :')

tomMoulard commented 1 year ago

Hello @mysther,

Thanks for your interest in the Traefik plugin !

What do you mean by 'it doesn't work at all' ? Can you show some logs or a reproducible use case ?

dontcrash commented 1 year ago

Pretty self explanatory here, when specifying rules the documentation shows it one way but the way that worked for the user was by writing it like this in the dynamic config:

http:
  middlewares:
    header-change:
      plugin:
        htransformation:
          Rules:
            - Name: "Replace nginx header"
              Header: "server"
              Type: "Set"
              Value: "Test"

On a side-note, this doesn't even work for me using either the specified format in documentation or what the OP was suggesting worked for them, I can still see the header: server: nginx/1.23.4