error_page & cookie

Denis Gabaidulin sherman at oemdesign.ru
Thu Aug 16 20:15:17 MSD 2007


Доброго времени суток.

У меня есть следующая конфигурация.

location /index.php {
	add_header Cache-Control no-cache,no-store;
	set $original_qs $query_string;

	if ($query_string ~* "c=([0-9]{1,6})(\;b=[0-2])?$") {
		rewrite (.+) /hit last;
	}
}

# handle hit
location /hit {
	include conf/fastcgi_params;

	fastcgi_param PATH_TRANSLATED /var/www/stinger/utils/counter.php;
	fastcgi_pass  unix:/var/run/php-cgi/php-cgi.sock;
	fastcgi_intercept_errors on;

	error_page 501 =200  /continue;
}

location /continue {
	internal;
	set $img_content_type 15;

	if ($http_accept ~* "image\/\*") {
		set $img_content_type 1;
	}

	if ($http_accept ~* "\*\/\*") {
		set $img_content_type 1;
	}

	if ($http_accept ~* "image\/gif") {
		set $img_content_type 1;
	}

	if ($original_qs ~* "c=([0-9]{1,6})(\;b=[0-2])?$") {
		set $client $1;

		rewrite (.+)  "/${client}_${img_content_type}" last;
	}
}

# TODO: move all headers to memcached;

# gif
location ~* "/[0-9]{1,6}_1$" {
	add_header		Cache-Control no-cache,no-store;
	default_type	image/gif;
	set			$memcached_key   "$uri?$args";
	memcached_pass  localhost:11211;

	# handle 404
	if ($content_length = "") {
		rewrite (.*) /banner.php?$original_qs last;
	}
}

# generate banner on the fly
location /banner.php {
	include conf/fastcgi_params;

	fastcgi_param PATH_TRANSLATED /var/www/stinger/src/web/banner.php;
	fastcgi_pass  unix:/var/run/php-cgi/php-cgi.sock;
}

В location "hit" у меня срабатывает php скрипт, и выдает заголовки:

Set-Cookie: ...
HTTP/1.1 501 Not Implemented

Проблема в том, что cookie дальше не передается, и соответсвенно
клиенту уже не приходит :-(

Как-нибудь можно передать в данном случае заголовок Cookie ?


p.s. Вместо 501 пробовал разные варианты, результат тот же :-(


More information about the nginx-ru mailing list