nginx rewrite with proxy_pass I want to proxy requests with nginx to different domain and also rewrite some part of the path. For example
http://origin.com/ - &gt; http://target.com/_plugin/kibana
How to accomplish such automated addition of _plugin/kibana part to any route that I request and forward to my target server
server {
    listen 80;
    server_name _;
    location / {
        proxy_set_header X-Forwared-Proto $scheme;
        rewrite ^(.*)$ /_plugin/kibana/$1 break;
        proxy_pass https://my-es-custer-in4lf3ruqx6shv2ndhju.us-east-1.es.amazonaws.com/;

    }
}

Should I have different location blocks or should I have a rewrite directive on a server level for this to work properly?
You do not need to use rewrite for your case, since you want to append _plugin/kibana to any routes.
Assuming the nginx config is for http://origin.com/:
server {
    listen 80;
    server_name origin.com;
    location / {
        proxy_set_header X-Forwared-Proto $scheme;

        # http://origin.com/req/1/2 will go to http://target.com/_plugin/kibana/req/1/2
        proxy_pass http://target.com/_plugin/kibana;

    }
}