How does Nginx get the variable of url

location /ws/chat/xxx/ {
            proxy_pass http://www.abc.com/ws/chat/xxx/;
        }

for example, xxx is a string, so how do I get this string and use it in proxy_pass

that string is similar to "20,35", which is the number + underscore + number

.

Is that what you want for

?

location ~ /ws/chat/([0-9]+_[0-9]+)/ {
    proxy_pass http://www.fanfei.site/ws/chat/$1/;
}
Menu