location /foo {
rewrite /foo/(.*) /$1 break;
proxy_pass http://site2.ru:80/;
proxy_redirect off;
proxy_set_header Host $host;
}
return new Promise((resolve, reject) => {
setTimeout(function() {
if (Math.random() > 0.5) {
return reject(new Error('some error');
}
resolve(1);
}, 1000);
})