HTTP GEO Module and Memcached Module question

Igor Sysoev is at
Sat Apr 28 22:43:17 MSD 2007

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;
>     US;
>      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.

Igor Sysoev

More information about the nginx mailing list