DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 10.8 Requiring Authentication for a Proxied Server

Problem

You wish to proxy content from a server, but it requires a login and password before content may be served from this proxied site.

Solution

Use standard authentication techniques to require logins for proxied content:

ProxyPass "/secretserver/" "http://127.0.0.1:8080"
<Directory "proxy:http://127.0.0.1:8080/">
    AuthName SecretServer
    AuthType Basic
    AuthUserFile /path/to/secretserver.htpasswd
    Require valid-user
</Directory>

Discussion

This technique can be useful if you are running some sort of special-purpose or limited-function web server on your system, but you want to apply Apache's rich set of access control and its other features to access it. This is done by using the ProxyPass directive to make the special-purpose server's URI space part of your main server, and using the special proxy:path <Directory> container syntax to apply Apache settings only to the mapped URIs.

See Also

    [ Team LiB ] Previous Section Next Section