I want to proxy requests with nginx to different domain and also rewrite some part of the path. For example
http://origin.com/
- > 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?