Page header and cache - problem

28 views
Skip to first unread message

Michele

unread,
Jul 17, 2013, 8:37:04 AM7/17/13
to ariad...@googlegroups.com
Hi

sometimes I found some pages like this
http://www.sns.it/scuola/istituzionale/amministrazione/formazionepersonale/iniziative/archivio/antincendio11/

It seems ariadne lost header and the browser shows the page as text.

Going into ariadne I found that the page has caching active (as you can see in the attachment)  but I'm sure I never actived it on that page.
The only way to solve this problem is to update cache and to Inherit configuration cache. It happens on random pages.

thank you in advance,
Michele

ps. thank you for the new release, I'll update on my development server as soon as possible.

Michele

unread,
Jul 17, 2013, 8:37:55 AM7/17/13
to ariad...@googlegroups.com
The attachment..
I'm using ariadne 2.7.8

Michele
Schermata 2013-07-17 a 14.33.03.png
Message has been deleted

Auke van Slooten

unread,
Jul 19, 2013, 4:17:08 AM7/19/13
to ariad...@googlegroups.com
Hi,

We've had similar problems sometimes and traced the problem back to a css or javascript template which was called in the page template - so the css or javascript is inline in the page. The css/javascript template sets a header using either the ldHeader(), ldSetContent() or ar('loader')->content() methods. If this template is called inline after the normale text/html header is set, it will override this, but only if caching is enabled.

The problem is that if you enable caching, then php's output buffering is started. This means that when you get to the css/javascript template no output has been sent to the browser yet, it is buffered. So php's headers_sent() method returns false and Ariadne's header methods will happily change the content-type header. If caching is not enabled, by the time you get to the inline css or javascript output has been sent to the browser, headers_sent() will return true and Ariadne's header methods will silently skip the headers.

The solution in this case depends on the exact use case. You can either remove the inline css/javascript or remove the content-type headers from them or as a last resort you might set the content-type header back to text/html after inlining the css/javascript.

We're currently debating whether or not Ariadne's header methods ( ldHeader, ldSetContent, ar('loader')->content(), etc. ) should fail silently. This is something left over from the early Ariadne days when this still seemed like a good idea... but to change it now may break quite a lot of ariadne sites.

Hope this helps,
Auke van Slooten
Muze

On Wednesday, July 17, 2013 2:37:04 PM UTC+2, Michele wrote:
Hi

sometimes I found some pages like this
http://www.sns.it/scuola/istituzionale/amministrazione/formazionepersonale/iniziative/archivio/antincendio11/

It seems ariadne lost header and the browser shows the page as text.


PS. when I access the above URL it sends the content-type as text/css, so it does seem like what I described is the problem here. 

Auke van Slooten

unread,
Jul 19, 2013, 6:15:25 AM7/19/13
to ariad...@googlegroups.com
Almost forgot,

There is a way to prevent templates from sending additional headers, even if output buffering is on. Simply add

<pinp>
    ar::putvar('arNoHeaders', true);
</pinp>

in your template before you call the offending css/javascript templates and no more headers will be added. This is a relatively new option, I'm not sure it is in ariadne 2.7.8.

regards,
Auke van Slooten
Muze

Reply all
Reply to author
Forward
0 new messages