Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to set up apache as an authentication front end for a web backend running on port 8080. The backend has no authentication, so if you curl localhost:8080 you get the website. Port 8080 is blocked externally, so what I want is for apache to authenticate a user accessing from port 80 and then proxy to port 8080.

I believe this should be possible, as per this post on stackoverflow:

I have tried to replicate this, however, I cannot get Apache to authenticate; it just passes directly to the proxy. Here is the virtual host config:

<VirtualHost *:80>


  <Location "/">
          Satisfy any
          require valid-user
          order allow,deny
          Allow from all

  ProxyRequests off
  ProxyPreserveHost on

  ProxyPass / http://localhost:8080/
  ProxyPassReverse / http://localhost:8080/

  <Proxy *>
          Order deny,allow
          Allow from all
          AuthType Basic
          AuthName "Private"
          AuthBasicProvider file
          AuthUserFile /path/to/htpasswd
          Require valid-user

This works in as much that browsing to outputs from the backend. So the proxy itself is working, but it's as if the Auth directives are being ignored. I also tried moving the Auth directives into the <location> block, but this has the exact same effect.

I am using Apache2 v2.2.22 running on Ubuntu 12.04. Any suggestions?

share|improve this question
up vote 2 down vote accepted

Satisfy any does exactly what it says: it allows access based on authentication or IP access control.

Since you allow the former in the Proxy block and the latter in the Location block, authentication is never required.

share|improve this answer
Critical Hit! Nice one adaptr, you solved it in one. Thanks a million – nightowl Dec 13 '12 at 14:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.