Getting the time or client ip address
Igor Sysoev
is at rambler-co.ru
Sat Aug 11 22:46:49 MSD 2007
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/
More information about the nginx
mailing list