Getting the time or client ip address
Igor Sysoev
is at rambler-co.ru
Tue Aug 14 18:03:41 MSD 2007
On Tue, Aug 14, 2007 at 08:45:39AM -0500, Fred Palmer wrote:
> Thanks for the idea, however going into the embedded Perl module is
> not really an option for our installation of Nginx. Can you recommend
> another method to retrieve a pseudo-random number upon each request to
> serve as a numbered variable? A number between 1-100 would be
> perfect. We want to just serve up different versions of our home page
> without going through the proxy to apache. The idea is to have
> version of the homepage named something like home_001.html,
> home_002.html, home_003.html or something similar.
Currently - no. I have plan to add functions (like variables) to nginx.
Also simple variable C module could be written that creates $rand varibale
returning random value 1-100.
> Thanks,
> Fred
>
> On 8/11/07, Igor Sysoev <is at rambler-co.ru> wrote:
> > On Sat, Aug 11, 2007 at 05:00:04PM +0000, Fred Palmer wrote:
> >
> > > I want to write a rewrite rule that will serve a file based on a pseudo-random
> > > variable such as time or client ip address.
> > >
> > > Is there a way to set that to a variable?
> >
> > http {
> >
> > perl_set $name '
> >
> > sub {
> > my $r = shift;
> > my $a = $r->remote_addr;
> >
> > # any perl code changing $a
> >
> > return $a;
> > }
> >
> > ';
> >
> >
> > server {
> > ...
> >
> > location = /some_file {
> > alias /path/to/file/$name;
> > }
> >
> > # or
> >
> > location / {
> > rewrite ... ...$name... break;
> > }
> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> >
>
>
> --
> Fred Palmer | Senior Software Engineer
> 615.653.7228 | www.studionow.com
>
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list