location /data { if ($kit_client) { return 301 http://192.168.26.170$request_uri; } return 301 http://$host/remote$request_uri; } location /remote/data { proxy_pass http://192.168.26.170/data; }