Corrected mod_rewrite in pypi mirror
This patch adds two RewriteCond with backreferences which check for the existence of an AFS-style split directory. If the directory exists, the rewrite rule will apply the necessary path changes. This patch permits passthrough of files such as index.html at the root directory, while not impacting the folder structure at sub-directory levels. This patch will break rather badly if pypi ever publishes a package named 'index.html'. Change-Id: I712f2d4e262b9e20378365af8173066522e2e0cd
This commit is contained in:
parent
9130d036f5
commit
137b185079
@ -22,16 +22,20 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
|
||||
</IfVersion>
|
||||
</Directory>
|
||||
|
||||
# Pypi URL's are:
|
||||
# /pypi/simple/a/a/a-etc.whl
|
||||
# /pypi/simple/a/abcd/abcd-etc.whl
|
||||
# /pypi/simple/a/abcde/abcde-etc.whl
|
||||
RewriteEngine On
|
||||
RewriteRule ^/pypi/simple/([^/])([^/]*)$ /pypi/simple/$1/$1$2 [L]
|
||||
RewriteRule ^/pypi/simple/([^/])([^/]*)/(.*)$ /pypi/simple/$1/$1$2/$3 [L]
|
||||
|
||||
# Pypi's bandersnatch URL's are:
|
||||
# /pypi/simple/index.html
|
||||
# /pypi/simple/a/a/(index.html)?
|
||||
# /pypi/simple/a/a/a-etc.whl
|
||||
# /pypi/simple/a/abcd/(index.html)?
|
||||
# /pypi/simple/a/abcd/abcd-etc.whl
|
||||
RewriteCond %{REQUEST_URI} ^/pypi/simple/([^/])([^/]*)
|
||||
RewriteCond %{DOCUMENT_ROOT}/pypi/simple/$1/$1$2 -d
|
||||
RewriteRule ^/pypi/simple/([^/])([^/]*)(/.*)?$ /pypi/simple/$1/$1$2$3 [L]
|
||||
|
||||
ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log
|
||||
LogLevel warn
|
||||
CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_access.log combined
|
||||
ServerSignature Off
|
||||
</VirtualHost>
|
||||
</VirtualHost>
|
||||
|
Loading…
x
Reference in New Issue
Block a user