Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What to use for SSI/ESI like feature? #35

Open
frozenminds opened this issue Apr 5, 2015 · 2 comments
Open

What to use for SSI/ESI like feature? #35

frozenminds opened this issue Apr 5, 2015 · 2 comments

Comments

@frozenminds
Copy link

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:

  • 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!

@agentzh
Copy link
Member

agentzh commented Apr 5, 2015

@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.

@frozenminds
Copy link
Author

Hi @agentzh,

Thanks for pointing me to the pure Lua direction and for the idea to continue the discussion on the mailing list.

I've posted the same question there. We can close this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants