I'm tring to get the URI parts to then pass it to the proxy_pass url. But I don't know about regex to do this.
I need to get the first and last URI into a variables to pass it on the proxy_pass like this:
https://example.com/user/port
to
proxy_pass http://user.example.com:$port