Спасибо, решение уже где-то рядом )
На боевом сервере за все отвечает php-скрипт.
Сделал так:
location / {
if ($http_cookie ~ 'newsitetest') {
rewrite ^ /newsite/$uri last;
}
rewrite / /not_found.php?query_uri=/&$args;
}
location ~* ^/(.+)$ {
if ($http_cookie ~ 'newsitetest') {
rewrite ^ /newsite/$uri last;
}
try_files $uri $uri/ /not_found.php?query_uri=/$1&$args;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.html;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QWERTY $document_root$fastcgi_script_name;
}
location /newsite/ {
proxy_pass http://192.168.2.146;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
После установки куки браузер выдает 500 ошибку, в логах nginx (который проксирует) ругань на циклический редирект
2014/08/28 18:21:51 [error] 19193#0: *454 rewrite or internal redirection cycle while processing "/newsite//newsite//newsite//newsite//newsite//newsite//newsite//newsite//newsite//newsite//not_found.php"