Hello there.
As of right now I’m using Haproxy to route requests to a 3rd party proxy provider.
Short explanation:
Haproxy listens on port 8887 and accepts requests from connections that provide a valid proxy-authorization via Header that match my haproxy userlist.
Requests are forwarded to my backend which deletes the proxy-header and sets the actual header needed to be authorized to access the 3rd party provider and sends out the request to them.
What I would like to achieve is being able to replace a certrain string of the username and replace it with a fixed value, while letting the rest of the string that was not matched stay as it is.
As an example.
User sends a request to us at 85.55.55.55:8887 with username admin_2 and password password
We receive a Authorization header corresponding to the base64 encoded value of admin_2:password
which is
Authorization Basic ‘YWRtaW5fMjpwYXNzd29yZA==’
What I would like to do is only replace the username admin with for example customerABC and keep the _2. So I end up with customerABC_2:password
What I tried in backend is using http-request replace-value like so:
http-request replace-value Authorization YWRtaW4= Y3VzdG9tZXJBQkM=
YWRtaW4= being the base64 encoding of admin
Y3VzdG9tZXJBQkM= being the base64 encoding of customerABC
I realize this is most likely not working due to the nature of base64 decoding, is there any workaround so I can get this to work?
3 posts - 2 participants