I want to parse the key information area code based on the post message, and then forward it to a specific address based on the region code. May I ask if my settings below can be forwarded to an address, but why is the forwarded body content empty? How can I fix it? Do I have to use OpenResty?
server {
listen 8850;
location / {
proxy_pass_request_body on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_body "$request_body";
proxy_set_header Content-Type "application/xml";
if ($request_body ~* "<areaCode>(123|245|789)</areaCode>") {
set $backend backend1;
}
if ($request_body !~* "<areaCode>(123|245|789)</areaCode>") {
set $backend backend2;
}
proxy_pass http://$backend;
}
}