Enable module on two locations

Maxim Dounin mdounin at mdounin.ru
Thu Aug 16 12:23:41 UTC 2012


Hello!

On Wed, Aug 15, 2012 at 04:05:22PM -0700, Prudhvi Krishna Surapaneni wrote:

> Hi List,
> 
> I have a module, that i am using to serve files from two different
> application specific locations.
> 
>  location ~ /download/([a-z0-9])/f/([a-z0-9]) {
>   my_module;
>   my_module_source_file file1;
>   my_module_id $1;
>   my_module_file_size $2;
>  }
> 
>  location ~/download/([a-z0-9])/q/([a-z0-9]) {
>   my_module;
>   my_module_source_file file2;
>   my_module_id $1;
>   my_module_file_size $2;
>  }
> 
>  My loc_conf_t is as follows
> 
>  typedef struct {
>  	ngx_http_complex_value_t *my_id;
> 	ngx_str_t source_file;
> 	ngx_http_complex_value_t *my_size;
>  }
> 
>  I run into problems when accessing files from the second location. The
>  module always trys to get file1 as the source instead of file2.
> 
>  My question is why does it always pick up the file1. But, interestingly
>  the complex values are captured correctly. How can i fix this scenario
>  so that it picks up the proper value for my_module_source_file basing
>  on the location it was called.

Most likely you did something wrong during configuration parsing 
and/or configuration merge in your module.  It's hard to say 
anything more without the code.

Maxim Dounin



More information about the nginx-devel mailing list