How can I add a query parameter to proxy_pass using Nginx Proxy Manager

Viewed 12

I'm trying to use Nginx Proxy Manager to add a query parameter to a path before passing it to a server using proxy_pass. The problem I'm having is that the query parameter doesn't seem to be added at all.

This is what I have added under "Custom Nginx Configuration":

location ~ /(sv|en)(.*) {
    proxy_pass http://192.168.1.2:3000$2?lang=$1;
}

If I change proxy_pass to return 307, just to test if the regex is correct, I see the expected url in the browser. (for example ?lang=en) is added.

Based on what I have found online, this should work in regular nginx, but I have also found that Nginx Proxy Manager uses openresty. Could that cause any problems? Should I write it in some other way?

0 Answers
Related