We need to proxy a request to a server. The sender has an autogenerated username and password, and will use basic authentication. We can't change these how these are generated by the sender.
The server will accept only usernames and passwords that are less than 32 characters. If the autogenerated ones are longer (and they often are) then the request will succeed if we truncate both to 32 characters.
So I need to examine the Authorization header, base64-decode the username and password, truncate each to at most 32 characters, and re-assemble the Authorization header before passing the request on.
Is there any way of doing this? I've perused the mod_headers doc and I can see how to do quite a lot of manipulation, but I can't see how to get this done...
Please check the mod_lua. You can hook the Apache auth_checker phase to do anything you want.
Go here for more details. http://httpd.apache.org/docs/trunk/mod/mod_lua.html