Add Header taken from query parameter

时间:2019-04-08 13:34:13

标签: haproxy

In my application to like to do a navigate to a link. Unfortunately, I am not able to add an access token to the Authorization header.

For this reason, I like to add it as a query parameter. When the request is processed in HAProxy I like to retrieve query parameter and add an Authorization header using the parameter value.

I would be very happy if someone has an idea why it is not working;

The following configuration I have added to HAProxy configuration. We testing I notice that the header is added, as it overwrites the Authorization when I add a header for test purpose.

Thanks,

Andreas

http-request set-var(req.token) urlp(token)
http-request set-header Authorization var(req.token)

1 个答案:

答案 0 :(得分:0)

在设置标头fmt表达式周围缺少%[...],即:

http-request set-var(req.token) urlp(token)
http-request set-header Authorization %[var(req.token)]