Nginx proxy_pass based on the POST / GET / PUT / DELETE parameter

I am trying to configure nginx to proxy_pass based on the POST / GET / PUT / DELETE parameter in my request.

I want proxy_pass before http://10.0.0.2:8000 if live=1 or http://10.0.0.2:8081 if live=0 .

I tried using if ($arg_live = "1") , but it only works for GET requests.

Thanks,

Pedro

+11
source share
2 answers

I suggest you try this ..

 if ($request_method = 'POST') { #your_directives_here } 
0
source

nginx proxy_pass based on the POST, PUT, or DELETE request method

You have the same question here, so instead of inserting anything from there, just go there and read.

-1
source

Source: https://habr.com/ru/post/954336/


All Articles