Would this work? location ~ ^/users/v2/ { proxy_pass http://app.domain.com/api/$1/v2; } Would $1 resolve as users or does it need to be inside ()? Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276652,276664#msg-276664