Chapter 9. Mirrors and proxies

lpm uses libwww to access primary repositories published on the web. All ancillary libwww features are available. Example: set the http_proxy to access remote repositories through an HTTP proxy:

http_proxy=http://firewall:port
export http_proxy
lpm options

Accessing remote repositories involves multiple HTTP requests. The first request is always "http://www.example.com/repository/VERSION". If lpm receives an HTTP redirect to this first request, lpm continues to use the new URL for all remaining requests. This makes it possible to mirror a repository in one of two ways.

  1. Configure www.example.com's web server to redirect all requests for "http://www.example.com/repository/VERSION" to a randomly selected "http://mirrorX.example.com/repository/VERSION".

  2. Use DNS-based load balancing, in addition to a local redirect script. Note that this approach distributes all HTTP requests with the same domain name, not just lpm's requests. Here's a hypothetical example with three mirrors:

    
$ORIGIN example.com.
    
    ...
    
    www          IN    A    10.0.0.1
    www          IN    A    10.0.0.2
    www          IN    A    10.0.0.3
    
    mirror1      IN    A    10.0.0.1
    mirror2      IN    A    10.0.0.2
    mirror3      IN    A    10.0.0.3

    mirror1's web server must be configured to respond with a redirect request for any "www.example.com/pathname" URL to "mirror1.example.com/pathname", for any pathname. Similarly, mirror2 must redirect any "www.example.com/pathname" URL to "mirror2.example.com/pathname", and mirror3 must redirect "www.example.com/pathname" "mirror3.example.com/pathname".

    The repository's published URL is "http://www.example.com/repository". Each access to the remote repository goes to one of the three servers, at random, which responds with a redirect to its actual hostname. The benefit of this approach is that it avoids burdening a single server with redirect requests from all clients.