The original post: /r/nginx by /u/CorgiClouds on 2024-07-03 20:19:44.

I have tried reading stack overflow and using chatgpt, but I keep losing the first part of my API end point when I try to switch things around with regex.

I want to redirect http://server/api/repo/t/<token>/channel to http://server/t/<token>/get/channel, but I keep just getting left with http://server/channel. Here is my most recent attempt:

location ~ ^/api/repo/t/(.*)$ {
    proxy_pass http://server/t/$1/get;
}

I have also tried using “rewrite”, to no avail. Please let me know if anyone has any suggestions.