9 messages in ru.sysoev.nginxRe: HTTP GEO Module and Memcached Mod...
FromSent OnAttachments
Liang JinApr 28, 2007 9:45 am 
Evan MillerApr 28, 2007 10:23 am 
Igor SysoevApr 28, 2007 11:42 am 
Liang JinApr 30, 2007 2:14 pm 
Evan MillerApr 30, 2007 10:45 pm 
Liang JinMay 1, 2007 11:41 am 
Evan MillerMay 1, 2007 10:00 pm 
Evan MillerMay 5, 2007 12:20 am 
Liang JinMay 5, 2007 2:47 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: HTTP GEO Module and Memcached Module questionActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Apr 28, 2007 11:42:54 am
List:ru.sysoev.nginx

On Sat, Apr 28, 2007 at 09:46:21AM -0700, Liang Jin wrote:

Hi, I started experimenting the HTTP GEO Module and Memcached Module from nginx, and have two questions:

1. HTTP GEO Module

in the http configuration, i added something like this to detect the IP address of the client and store the country code in the $geo variable.

geo $geo { default US; 127.0.0.1/32 US; 10.1.0.0/16 UK; ...... }

But the question is how I can transfer the variable to the backend Apache server and let the PHP script know about the $geo variable. I understand that for fastcgi you can get $geo as a parameter, just like this:

fastcgi_param GEO $geo;

However, for reverse_proxy to Apache, how can I pass the $geo variable on to the Apache server and eventually the PHP script?

proxy_set_header X-Geo $geo;

It will available in Apache as HTTP_X_GEO.

2. Memcached Module

Using 0.5.9 version, I have succeeded in making the memcache module query and fetch the key value stored in Memcached.

For example, if I set the key value in memcached in text format as "whatever", nginx can query and get the value and feed it back to the client browser. However, the question is: even if the text is valid HTML, the browser still thinks it is data, not web pages, so it offers me to download. I guess I need to set extra headers before the HTML in order to make it work, but I cannot find any information on this.

Currently, as it was suggested you can use default_type directive only:

location ~* \.html$ { memcached ... default_type text/html; }

I have plan to get headers from memcached if memcached response has set some flag.