location ~* ^/internal-proxy/(https?)/(.*?)/(.*) { resolver 127.0.0.1; set $proxy_protocol $1; set $proxy_host $2; set $proxy_path $3; proxy_pass $proxy_protocol://$proxy_host/$proxy_path ; proxy_set_header Host $proxy_host; }