We-Amp / ngx_pagespeed

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
22 stars 1 forks source link

Clarification on "flush window" for "combine heads" filter #5

Closed oleksii-donoha closed 8 months ago

oleksii-donoha commented 9 months ago

Hello @oschaaf, thanks for keeping the repo alive.

I would appreciate the clarification about the terms "flush window" and "flush" in the context of nginx. Context: I am maintaining an nginx setup with SSI and mod_pagespeed, and I am having a problem with heads not combining in some cases. I've done some testing and determined that some combinations of the sub-pages included with SSI produce this result.

Here's what the docs say:

The 'Combine Heads' filter operates within the scope of a "flush window". Specifically, large or dynamically generated HTML files may be "flushed" by the resource generator before they are complete. If the CSS combiner encounters a Flush prior to the end of the first <head>, then subsequent <head>s will not be merged in.

I'm having trouble figuring out what these "flush" events could be. Would you be able to clarify?

oschaaf commented 9 months ago

Sorry, late reply, but I remember digging into something similar quite a while ago. I can find some traces of that using google search, e.g. https://github.com/apache/incubator-pagespeed-ngx/pull/906#issuecomment-74089777

Unfortunately my recollection is nearly non-existent .. I think that depending on the module ordering pagespeed might do per-ssi optimization instead of having the full scope of the combined html doc. Could that be what you are observing?

oleksii-donoha commented 8 months ago

Sorry, late reply, but I remember digging into something similar quite a while ago. I can find some traces of that using google search, e.g. apache/incubator-pagespeed-ngx#906 (comment)

Unfortunately my recollection is nearly non-existent .. I think that depending on the module ordering pagespeed might do per-ssi optimization instead of having the full scope of the combined html doc. Could that be what you are observing?

Yeah, that's what we figured. In layman's terms: if your SSI fragment is further down the document, its <head> might be out of scope when the optimization occurs. Thanks @oschaaf