Apache reverse proxy with basic authentication

Vincent P picture Vincent P · Feb 16, 2011 · Viewed 85.5k times · Source

Trying to configure my reverse proxy with basic authentication before forward the traffic to my back end server. Can any one give me a solution.

Example here:

User(internet) -> reverse proxy / vhosts server (need to add basic authentication here ) -> back end server ( non authenticated )

Answer

Lawrence Kesteloot picture Lawrence Kesteloot · Oct 13, 2011

You can follow the instructions here: Authentication, Authorization and Access Control. The main difference for your reverse proxy is that you'll want to put the auth stuff inside a Location block, even though the docs say that they're only allowed in Directory blocks:

<Location />
    AuthType Basic
    ...
</Location>

Outside the Location block you can put your proxy commands, such as:

ProxyPass / http://localhost:8080/