3 messages in ru.sysoev.nginxRe: Hello
FromSent OnAttachments
Mansoor PeerbhoyJul 23, 2007 2:03 am 
Igor SysoevJul 23, 2007 2:45 am 
Mansoor PeerbhoyJul 23, 2007 2:53 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: HelloActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Jul 23, 2007 2:45:06 am
List:ru.sysoev.nginx

On Mon, Jul 23, 2007 at 02:03:31AM -0700, Mansoor Peerbhoy wrote:

Anyway, a quick question:

I am using NGINX as an HTTP (reverse) proxy, and I need to conditionally
redirect some URLs to an external FASTCGI server. I have read the HTTP rewrite module documentation at
http://wiki.codemongers.com/NginxHttpRewriteModule and I see that there are ways
to conditionally rewrite certain URLs.

I wonder if there is any complete set of NGINX variables ( A sort of NGINX
variable reference ) that I can refer to ?

The reason I ask for such a reference is, because the conditions for a rewrite,
in my case, are rather complicated.

The most of nginx variables has the same names as in Apache.

http://wiki.codemongers.com/NginxHttpCoreModule#variables

For instance, I should like to say: . If URL begins with /xxxx/ AND if the HTTP method is POST, AND if there is no
cookie named CCCC in the HTTP header, then redirect the url to /abc/def/
otherwise let it fall through to the default handler.

I wonder if this is possible using the syntax described at
http://wiki.codemongers.com/NginxHttpRewriteModule

The ngx_http_rewrite_module currently has many limits and drawbacks.

You may try the following:

location /xxxx/ { set $test "";

if ($request_method = POST) { set $test P; }

if ($http_cookie ~* "CCCC=.+(?:;|$)" ) { set $test ${test}C"; }

if ($test = PC) { fastgci_pass ...; }

# you have to set fastcgi_param at this level, # however, it does not mean that request goes to fastcgi

fastcgi_param ...; fastcgi_param ...; fastcgi_param ...;