Welcome! Log In Create A New Profile

Advanced

Снова proxy_redirect и regexp

September 28, 2010 05:00PM
Вопрос несколько раз уже поднимался тут:
http://www.lexa.ru/nginx-ru/msg15287.html
http://forum.nginx.org/read.php?21,109566,111202

Необходимо делать proxy_redirect вида:
[code]
proxy_redirect http://(.*)\.test_string\.(\w+) http://www.domain.com;
[/code]


Пробовал делать через проверки вида:
[code]
if ($upstream_http_location ~* test_string)
{
more_set_headers 'Location: http://www.domain.com';
}
[/code]
Но толку мало, т.к. проверка в location идет перез запросом к бэкенду:

[quote][debug] 44002#0: *17054 http script regex: "test_string"
[notice] 44002#0: *17054 "test_string" does not match "", client: 173.74.30.160, server: domain.com, request: "GET /out.php HTTP/1.1", host: "domain.com"
[debug] 44002#0: *17054 http script if
[debug] 44002#0: *17054 http script if: false[/quote]

Это изменение я думаю тоже к делу не относится:
[quote]
Изменения в nginx 0.5.20 07.05.2007

*) Добавление: переменные "$http_...", "$sent_http_..." и
"$upstream_http_..." можно менять директивой set.[/quote]

Мб кто-то уже решал подобную задачу?
Subject Author Posted

Снова proxy_redirect и regexp

Askon September 28, 2010 05:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 259
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready