Is it possible to send html HEAD early (chunked)?

mex nginx-forum at nginx.us
Sun Jul 13 16:37:43 UTC 2014


> Ok, I haven't done anything with nginx+lua so far, need to check out
> what
> can be done with lua. Can you give some direction how lua can be
> helpful here?

oh ... lua might be used to manipulate every single phase of a request
coming to and processed by nginx; so a swiss army knife 
super-extended version :)


some stuff to skim through to get an impression: 
- https://github.com/openresty/lua-nginx-module#typical-uses
- http://wiki.nginx.org/HttpLuaModule 

in your case i'd say the cleanest way would be a reengineering
of your application; the other way would imply a full regex
on every request coming back from your app-servers to filter out
those stuff that already has been send. 
the problem: appservers like tomcat/jboss/rails a.s.o. 
usually send full html-pages; if you find a way to just
send the <body> itself,  the rest like sending html-headers early
from cache seems easy:


location /blah {
            content_by_lua '
                ngx.say(html_header)
                local res = ngx.location.capture("/get_stuff_from_backend")
                if res.status == 200 then
                    ngx.say(res.body)
                end
                ngx.say(html_footer)
               ';
        }


do you refer to something similar to this?
https://github.com/bigpipe/bigpipe







> 
> > from what i understand you have a "static" part that should get send
> > early/from
> > cache and a "dynamic" part that must wait for the backend?
> 
> Exactly.
> 
> Cheers,
> Martin
> 
> > the only solution i could think of in such an asynchronous delivery
> > is using nginx + lua, or maybe varnish (iirc you yould mark parts of
> a
> > page cacheable, but dont know if you can deliver asynchronously
> though)
> >
> >
> >
> > regards,
> >
> >
> > mex
> >
> > Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,251717,251719#msg-251719
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251717,251722#msg-251722



More information about the nginx mailing list