I have an old Apache server that’s serving as a reverse proxy for my webcam. I swapped webcams out and unfortunately the new one requires authentication. I had to figure out how to get Apache to reverse proxy with the proper authentication. The best information I found was given by user ThR37 at superuser.com
sudo a2enmod headers #if you're on ubuntu then it's mod_headers
I then needed to generate the basic authentication hash for the header to pass. This was done via a simple python script:
#replace USERNAME:PASSWORD below with your credentials import base64 hash = base64.b64encode(b'USERNAME:PASSWORD') print hash
Save the above script into a file hash.py and then run it by typing
With headers enabled and hash acquired I just needed to tweak my config by adding a RequestHeader line:
RequestHeader set Authorization "Basic <HASH>" #Replace <HASH> with hash acquired above
After adding that one line and restarting apache, it worked!