title: Apache2 - authorize users against a Location using BasicAuth but ONLY for users outside local subnet
body: <p>In my Apache 2 config I have a <code>VirtualHost</code> which looks something like this:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerName sub.domain.com
  
    # username:password sent on to endpoint
    RequestHeader set Authorization "Basic dXNlcm5hbWU6cGFzc3dvcmQ=="
  
    ProxyPass        /xyz http://192.168.1.253:8080/endpoint
    ProxyPassReverse /xyz http://192.168.1.253:8080/endpoint
  
    &lt;Location /xyz&gt;
      # This needs to let users through under the following circumstances
      #   * They are in 192.168.1.0/24
      #   * They have a valid user in a htpasswd file
  
      # So what goes here?
    &lt;/Location&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I am using the virtual host as reverse proxy to another server (which I will call the endpoint) on the network. </p>
  
  <p>I am trying to figure out a configuration that would allow users inside the network browsing to <code>sub.domain.com</code> to automatically be served the endpoint. However, users outside the network should be prompted for credentials</p>
  
  <p>The endpoint requires a password which I have hidden by using RequestHeader (which I want). The password external users should be prompted by is DIFFERENT and will need to be BasicAuth, getting it's user list from a <code>htpasswd</code> file.</p>