Welcome! Log In Create A New Profile

Advanced

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

Martin Grotzke
July 13, 2014 02:54PM
Am 13.07.2014 18:37 schrieb "mex" <nginx-forum@nginx.us>:
>
> 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;

We're using the play framework, we can easily send partial content using
chunked encoding.

> 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)
> ';
> }

The html head, page header and page footer are dynamic as well and depend
on the current request (but are easy to calculate - sorry if my previous
answer was misleading here).
I think the cleanest solution would be if the backend could receive 1
request and just split the content/response into chunks and send what's
immediately available (html head + perhaps page header as well) as first
chunk and send the rest afterwards.

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

Not exactly this framework but the bigpipe concept. The idea I really like
is that the browser can start to download js + CSS and that the user can
already see the page header with navigation while the backend is still
working - therefore a much better perceived performance.

Cheers,
Martin


> >
> > > 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@nginx.org
> > > http://mailman.nginx.org/mailman/listinfo/nginx
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
> Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,251717,251722#msg-251722
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

Martin Grotzke July 13, 2014 08:50AM

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

mex July 13, 2014 09:40AM

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

Martin Grotzke July 13, 2014 11:36AM

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

mex July 13, 2014 12:37PM

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

Martin Grotzke July 13, 2014 02:54PM

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

mex July 14, 2014 08:23AM

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

Valentin V. Bartenev July 13, 2014 04:02PM

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

Martin Grotzke July 13, 2014 06:28PM

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

Maxim Dounin July 14, 2014 08:56AM

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

Martin Grotzke July 14, 2014 02:36PM

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

Maxim Dounin July 15, 2014 08:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 53
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready