Nginx feature request

Hendrik Hardeman hendrik.hardeman at
Sun Feb 10 21:37:33 MSK 2008


Thanks for the suggestion, but when I propose this feature, it's exactly because I want to *avoid* something on top of Nginx (whether Perl, Python, PHP or anything else) !

My need is very simple. All I want is to be able to disallow Nginx to serve certain files based on filetime. This could be done in two ways:

A directive which is off by default but which can be switched on in any of the standard places - most likely place would be in 'location'. Let me tentatively name this directive 'filetime_check'. If the directive is on, nginx would not serve any files with a filetime later than current server/request time. Instead it would return a 403 error so that we can distinguish between 'file not found' and 'access not allowed'.
You could then define something like:

location /ftc/ {filetime_check on;}

Any request for a file in location /ftc/ with a filetime later than request time (i.e. in the future) would then return 403.

Independent from the above, it might be useful to be able to access the filetime of requested file for defining rewriting rules or for ssi. This could either be through a variable or through a function:

if ($date_gmt < fct($request_filename)) {do something, e.g. return 403;}

Nginx already has to check the last modification time of requested files, so adding a directive as proposed in 1 shouldn't put a lot of extra burden on it. Shouldn't be too hard to implement this myself privately, but I thought that others might find this useful as well and in that case an official feature is probably better.

Hendrik Hardeman

> Date: Sun, 10 Feb 2008 18:05:29 +0100
> From: manlio_perillo at
> To: nginx at
> Subject: Re: Nginx feature request
> Hendrik Hardeman ha scritto:
> > Hi all,
> > 
> > Discovered Nginx a few weeks back. After some experimenting I have come 
> > to the conclusion that Nginx really is very very good.
> > 
> > I have a small feature request:
> > 
> > I have a set of static files (html and others) which I want to make 
> > available only from a certain date/time. Inspired by the rewrite module, 
> > this morning I thought of a simple method to control access to such files.
> > 
> > My idea was to set the file creation/modification time of the static 
> > files in the future, i.e. the date/time from which they can be made 
> > available (e.g. I could use the touch tool to set the appropriate 
> > date/time). I could then do something like
> > 
> > if (!-f $request_filename) {return 404;}
> > if ($date_gmt < fct($request_filename)) {return 403;}
> > 
> > Unfortunately, I haven't found a way to get at the file 
> > creation/modification time (please do let me know if I overlooked 
> > something). 
> You can use the embedded Perl module.
>  > [...]
> Manlio Perillo

Tried the new MSN Messenger? It’s cool! Download now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list