upstream backend { ip_hash; server production.s3.rubygems.org; } server { listen 80; server_name bb-m.rubygems.org bluebox.mirrors.rubygems.org; access_log /var/log/nginx/mirror.access.log main; error_log /var/log/nginx/mirror.error.log info; location /gems/ { proxy_pass http://backend; proxy_set_header Host production.s3.rubygems.org; proxy_ignore_headers X-Accel-Expires Expires Cache-Control; proxy_cache one; proxy_cache_key backend$request_uri; proxy_cache_valid 200 301 302 30d; proxy_cache_valid 404 1m; proxy_cache_valid any 15m; proxy_cache_use_stale error timeout invalid_header updating; } location /quick/ { proxy_pass http://backend; proxy_set_header Host production.s3.rubygems.org; proxy_ignore_headers X-Accel-Expires Expires Cache-Control; proxy_cache one; proxy_cache_key backend$request_uri; proxy_cache_valid 200 301 302 30d; proxy_cache_valid 404 1m; proxy_cache_valid any 15m; proxy_cache_use_stale error timeout invalid_header updating; } location / { rewrite ^ http://rubygems.org$request_uri redirect; } }