Apache mod_proxy with automatic authentication

I have actually found the solution. I hope it can be useful for other people:

Run the following python script to get your authentification hash:

import base64
hash = base64.b64encode(b'user:password')

Add the following directive in your apache configuration:

<Location /mypath>
RequestHeader set Authorization "Basic $hash"
</Location>

where $hash is replaced with the previously computed string.

Make sure that mod_proxy and mod_headers are available (a2enmod proxy and a2enmod headers). Restart apache2 and you are done :)