You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a project where I need an SSI/ESI like feature. For full page cache I am now using the srcache-nginx-module with Redis and a PHP backend. There will be at least 3 blocks per page which I need whole-punched with something like SSI/ESI and these will also be cached.
SSI does not play well with Lua, on the other hand if I am using SSI with srcache_fetch only then it won't work on my sub-requests.
What would be a good (elegant and also performance wise) approach to replace SSI/ESI tags in both the backend and srcache_fetch responses? Liked replace-filter-nginx-module, but it does not support Lua replacements which I need.
I've done some research and testing, but none worked so far:
Use a template engine - no buffer and how to process cached responses
use body_filter_by_lua would fail when chunk ends in the middle of a placeholder
Thank you in advance!
The text was updated successfully, but these errors were encountered:
@frozenminds For such fancy requirements, I suggest you go with pure Lua solutions without using such complicated combinations of nginx C modules.
You can do complicated streaming upstream and downstream communications, template-based content generation, remote/local data caching of various levels of granularity, and much more in your single content_by_lua handler with pure Lua.
BTW, it's worth mentioning that the body_filter_by_lua is invoked on each response body data chunk, so you need a proper state machine to take aribitrary chunk boundaries into account (just like the ngx_sub_filter and ngx_replace_filter modules, which are nginx output filters themselves).
Believe me, messing up with complicated nginx subrequests and SSI can never be an enjoyable experience :)
BTW, you're recommended to join the openresty-en mailing list for such general discussions. Please see this page for more details: http://openresty.org/#Community Thanks for your cooperation.
Hello,
I am working on a project where I need an SSI/ESI like feature. For full page cache I am now using the
srcache-nginx-module
with Redis and a PHP backend. There will be at least 3 blocks per page which I need whole-punched with something like SSI/ESI and these will also be cached.SSI does not play well with Lua, on the other hand if I am using SSI with
srcache_fetch
only then it won't work on my sub-requests.What would be a good (elegant and also performance wise) approach to replace SSI/ESI tags in both the backend and
srcache_fetch
responses? Liked replace-filter-nginx-module, but it does not support Lua replacements which I need.I've done some research and testing, but none worked so far:
body_filter_by_lua
would fail when chunk ends in the middle of a placeholderThank you in advance!
The text was updated successfully, but these errors were encountered: