'Nginx proxy remove spesific path and emty Post request body +HTTPS

I'm using nginx for web service proxy. I have rest service as below and i want to proxy my domain https://www.example.com/myRestservice. Service has some method like this;

http://1.1.1.1:123/api/work/method1
http://1.1.1.1:123/api/work/method2

*By the way services publish on two server as below in nginx.conf

As result i want to access to methods of service like "https://www.example.com/Restservice/api/work/method1"..

When i try to use rewrite in nginx as below, i can access service. But in this time Post method's request body is emty. I can see service logs.

In my nginx.config

upstream RestService {
    server 1.1.1.1:123;
    server 1.1.1.2:123;
}
server {
        listen                443 ssl;
        server name           https://www.example.com;

 location ~ ^/Restservice/ {
           
    add_header Access-Control-Allow-Origin *;
    rewrite ^/Restservice/(.*) /$1 break;
    proxy_pass http://Restservice/;
    proxy_http_version  1.1;
}
}

Bye the way i try to location part like this, result is same.

  location   /Restservice { 
    
    proxy_pass http://Restservice/;
}

Normally I can access soap service with config from https link. Is it about http redirection to https ?

In nginx access log; status : 500 request: POST /Restservice/api/work/method1 HTTP/1.1



Solution 1:[1]

I find the reason. Because of the endcoding. After choosing endcoding type 'UTF-8', I could see request body.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zgr