How to restrict Apache Location directive to cetain sub-domain?

Posted by ohho on Server Fault See other posts from Server Fault or by ohho
Published on 2013-11-12T02:14:39Z Indexed on 2013/11/12 3:57 UTC
Read the original article Hit count: 527

Filed under:
|
|

On our server www.example.com, we use the <Location> directive to proxy traffic to a back-end server:

<Location /app1>
  ProxyPass http://192.168.1.20
</Location>

Then we added a sub-domain uat.example.com which points to the same IP address of www.example.com. We want to use it as a proxy for client to test an app being developed. Hopefully, the client can access via:

http:/uat.example.com/app2_uat

Now if we add a Location:

<Location /app2_uat>
  ProxyPass http://192.168.1.30
</Location>

The client can access both:

http:/www.example.com/app2_uat
http:/uat.example.com/app2_uat

How can I restrict Location such that only:

http:/uat.example.com/app2_uat

is accessible? (i.e. http:/www.example.com/app2_uat should not be accessible.)

© Server Fault or respective owner

Related posts about apache2

Related posts about centos