Hi,

On Sun, Mar 03, Jeff wrote:
> I need to add an authorization header for a target server, e.g.
>    http-request add-header Authorization Bearer\ MYTOKENDATA
> 
> where MYTOKENDATA is read from a file for each proxy message.

Does this mean that each http request needs to read the MYTOKENDATA from
file (file read access for each and every request) ?

> (MYTOKENDATA is written asynchronously to the file by another
> process.)
> 
> How to do this in HAProxy?

Just a few ideas from top of my head:
- use maps / cli to update map values
  (https://www.haproxy.com/blog/introduction-to-haproxy-maps/)
- lua could probably do this, but AFAIK doing file io will block rest of
  the haproxy, so it might be better to read the MYTOKENDATA from redis
  or memcache (or something similar).

Is your use case something like described here:
https://www.haproxy.com/blog/using-haproxy-as-an-api-gateway-part-2-authentication/

-Jarno

-- 
Jarno Huuskonen

Reply via email to