location ~ /proxy/(.*)/(.*)/(.*)$ { set $scheme $1; set $host $2; set $path $3; proxy_pass $scheme://$host/$path; }