Today I learned, how I can use Regex in location with proxy_pass. By default it is not supported by nginx, but we can capture the url with location and then pass it to the proxy_pass. Another solution is do a rewrite...break then do a proxy_pass.

Source