4

I'm trying to proxy a certain rest endpoint on my linux api box to my windows box. Here's what I have right now.

My linux api box

...
location ~ ^/api/v0/roslyn(.*)$ {
    resolver 8.8.8.8;
    proxy_pass $scheme://my-windows-box.com/roslyn$1;
}

For example, I'd like to proxy the following url

http://my-linux-box.com/api/v0/roslyn?q=5

to

http://my-windows-box.com/roslyn?q=5

However, it seems to be missing the querystring, so the regex is failing?

1 Answers1

7

I don't think you can match the args by regex, try this instead

location /api/v0/roslyn {
    resolver 8.8.8.8;
    proxy_pass $scheme://my-windows-box.com/roslyn$is_args$query_string;
}
Mohammad AbuShady
  • 40,884
  • 11
  • 78
  • 89