Consult, nginx agent configuration problem

-sharp
server {
    listen       80;
    charset utf-8;
    -sharprest
    location /abc {
        proxy_pass http://test.com/;
    }
}

the requirement is like this. All local access addresses with / abc are forwarded by proxy. For example, accessing http://localhost/abc/1/ will request http://test.com/abc/1/, that is, accessing http://localhost/abc/ / will enter http://test.com/abc/ / . How to write such a rule? Have you ever tried? Please take a look at it, thank you very much!

Mar.08,2021

location ^~ /abc {
    proxy_pass http://test.com/;
}

location ^~ /abc {
    proxy_pass http://test.com/$request_uri;
} 

solved with the above code, thanks to the brothers above.

Menu