server { listen 80; charset utf-8; set $root_path '/go/src/app'; root $root_path; proxy_cache_use_stale error timeout invalid_header http_502; proxy_cache_min_uses 1; location / { proxy_pass http://app; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_cache cache; proxy_cache_valid 30m; } location /minecraft.php { if ($arg_name = "") { return 400; } if ($arg_type = "cloack") { rewrite .* http://skins.minecraft.net/MinecraftCloaks/$arg_name.png? permanent; break; } if ($arg_type = "skin") { rewrite .* /skins/$arg_name last; break; } return 404; } location /cloaks/ { try_files $uri $uri.png @cloaks; } location @cloaks { rewrite ^/cloaks/(.+?)(\.[^.]*$|$)$ http://skins.minecraft.net/MinecraftCloaks/$1.png? permanent; } location ~* ^/skins/$ { if ($arg_name = "") { return 400; } rewrite .* /skins/$arg_name last; } location ~* ^/cloaks/$ { if ($arg_name = "") { return 400; } rewrite .* /cloaks/$arg_name last; } }