0

I have an Apache2 server that is serving a mirror of some Ubuntu repositories, and proxying out requests for files that it does not have. However it looks like the proxying is causing the auto-generated index to not be served, which admittedly only makes browsing the site in a web browser difficult. I have tried rewrite rules that exclude index.html, but it looks like those do not work.

The site's config file is:

<VirtualHost *:80>

        ServerAdmin [redacted]

        ServerName archive.ubuntu.com
        ServerAlias *.archive.ubuntu.com
        DocumentRoot /var/www/mirror/archive.ubuntu.com

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        RewriteEngine on

        # only proxy out if we dont have the file locally
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        # only proxy out if we dont have the directory locally
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
        # only proxy out if we dont have the link locally
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-l
        # capture any sub sub domains, ie cloud-bits.archive.canonical.com
        RewriteCond %{HTTP_HOST} ^(.*\.)?archive\.ubuntu\.com [NC]
        # proxy the connection outbound if above conditions pass
        RewriteRule ^/(.*)$ http://%1archive.ubuntu.com/$1 [P,QSA,L]

</VirtualHost>

I have confirmed the auto-generating index works, as sites that do not proxy out serve a directory list as desired. Is there any way to both proxy out files that the server does not have and to serve an auto-generated index?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.