Best way to get $request_filename

Maxim Dounin mdounin at mdounin.ru
Wed Jul 15 23:37:56 MSD 2009


Hello!

On Wed, Jul 15, 2009 at 10:13:26PM +0300, Marcus Clyne wrote:

> Hi,
>
> What's the best way to get the variable $request_filename from a custom  
> module?
>
> Currently I save the index of the $request_filename variable and call  
> ngx_http_get_indexed_variable (r, request_filename_var_index), but is  
> there a better way?

If you need variable - using indexed one is the best choise.

For request filename you may want to consider using 
ngx_http_map_uri_to_path() directly though.  See static module (or 
gzip static, or flv, or request_filename variable get handler code) 
for examples.

Maxim Dounin





More information about the nginx mailing list