Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache reverse proxy with basic authentication

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 )

like image 577
Vincent P Avatar asked Feb 16 '11 00:02

Vincent P


People also ask

Does a reverse proxy provide authentication?

Introduction. The reverse proxy can be used to authenticate and authorize requests before they are proxied to the destination servers. This can reduce load on the destination servers, add a layer of protection, and ensure consistent policies are implemented across your applications.

Can Apache work as a reverse proxy?

In addition to being a "basic" web server, and providing static and dynamic content to end-users, Apache httpd (as well as most other web servers) can also act as a reverse proxy server, also-known-as a "gateway" server.


1 Answers

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/ 
like image 56
Lawrence Kesteloot Avatar answered Sep 30 '22 00:09

Lawrence Kesteloot