Nginx how to retain the hostname in the uri and perform rewrite
location /app1/ {
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
rewrite /app1/(.*) /$1 break;
proxy_pass <**how to pass the incoming request hostname as it is without hardcoding it**>
}
proxy_pass