Score:0

Nginx split the URI into variables to use on proxy_pass

in flag

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
Score:0
kz flag

You can use regex.

Nginx config Example:

location ~ ^/(\w+)/(\d+)$ {
  set $user $1;
  set $port $2;
  proxy_pass http://${user}.example.com:$port;
}
in flag
Thank you, I did like this: location ~ ^/(.*)/(.*)$ { proxy_pass http://$1.example.com:$2/; } is correct also?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.