FileCachePath unique based on nginx variable

48 views
Skip to first unread message

Uri Foox

unread,
Oct 31, 2019, 9:03:10 PM10/31/19
to ngx-pagespeed-discuss
Hello,

I see that you can set     pagespeed ProcessScriptVariables on;   and for some variables it works, unfortunately pagespeed FileCachePath /.pagespeed_cache/$host/; doesn't seem to parse $host. I looked at the source and see src\ngx_pagespeed.cc has     

const char* file_cache_path =        cfg_s->server_context->config()->file_cache_path().c_str();

Which seems like it's just getting the raw string of the value set in the Nginx conf.

I see that ShardDomain does process $host so I looked at ngx_rewrite_options.h and saw that it's calling something like this

ngx_conf_t* cf, ProcessScriptVariablesMode script_mode

which I assume is what it uses to parse "$host" when called in the ShardDomain config

Would someone be able to point me further as to what I would need to change in ngx_pagespeed.cc to have the file_cache_path process $host like ShardDomain is doing? I'm not too familiar with C++

Thanks,
Uri



Otto van der Schaaf

unread,
Nov 1, 2019, 4:02:32 AM11/1/19
to ngx-pagesp...@googlegroups.com
Naive question: why would you need per-request dynamic behaviour of the file cache path? 

Currently the FileCachePath setting is fixed / processed at startup time by design, so it's not just configuration processing that would need to change. 
That's why it's excluded from having dynamic script variables being processed. A lot of things would have to change to get that functional.

So .. I can see that per-host separation at startup time might be nice (and I actually think that internally something like
that is done by the module already for other reasons), but perhaps that could also be implemented by generating the configuration?
If you're looking to implement resource caps per vhost: FileCachePath can also be specified at the server{} level.

Otto



--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ngx-pagespeed-discuss/e0426d2b-0569-4608-8dd8-e316451a7781%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages