###############
# pypiserver  #
###############
<IfModule mod_ssl.c>
<VirtualHost *:443>
    UseCanonicalName on

    Keepalive On
    RewriteEngine on

    ServerName ${FQDN}

    SSLCompression      off

    RewriteRule    ^/simple$  /simple/  [R]
    ProxyPass      / http://127.0.0.1:4000/ Keepalive=On max=50 timeout=300 connectiontimeout=10
    ProxyPassReverse   / http://127.0.0.1:4000/
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
    RequestHeader set X-Forwarded-Host "${FQDN}"

    Header set Service "pypi"

    CacheRoot "/var/cache/apache"
    CacheEnable disk /
    CacheDirLevels 4
    CacheDirLength 1

    CacheDefaultExpire 3600
    CacheIgnoreNoLastMod On
    CacheIgnoreCacheControl On
    CacheMaxFileSize 640000
    CacheReadSize 1024
    CacheIgnoreNoLastMod On
    CacheIgnoreQueryString On
    CacheIgnoreHeaders X-Forwarded-Proto X-Forwarded-For X-Forwarded-Host

    # Debug. Turn these two variables off after testing.
    CacheHeader on
    CacheDetailHeader On

    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/${FQDN}/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/${FQDN}/privkey.pem
</VirtualHost>
</IfModule>
