Store site view in HTTP headers

morphir - January 16, 2007 - 19:22
Project:Drupal
Version:5.x-dev
Component:base system
Category:feature request
Priority:normal
Assigned:morphir
Status:duplicate
Description

There is no caching in headers by default in core.

  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", FALSE);

Now, where a user is reading lots of comments. And gets tempted to click a link, he then decides to return and needs to start all over again(at the top). This is literally just silly and annoying. Now caching the page view so he ends up where he was reading is the solution.

I have always thought that this was a browser issue. But I realize this pretty much happens when surfing drupal sites.

#1

morphir - January 16, 2007 - 19:23

Additional information:

drupal_page_header()
includes/bootstrap.inc, line 486

http://api.drupal.org/api/head/function/drupal_page_header

#2

morphir - January 19, 2007 - 19:33
Status:active» patch (reviewed & tested by the community)

Line 487

Jippii. Drupal now caches the page. Again, I see notting but positive reasons this lines being changed to the following.

function drupal_page_header() {
  header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: store, cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", FALSE);
}

AttachmentSize
bootstrap_1.inc26.11 KB

#3

morphir - January 21, 2007 - 01:47
Title:Cache HTTP headers» Store site view in HTTP headers

I found out that only store is necessery. So store in stead of no-store.

#4

RobRoy - January 22, 2007 - 07:11
Version:5.x-dev» 6.x-dev
Status:patch (reviewed & tested by the community)» patch (code needs work)

Please don't RTBC your own patches. Features go against next version. Also, your patch is not really a patch. See http://drupal.org/patch on how to make a patch.

#5

morphir - January 29, 2007 - 14:12
Status:patch (code needs work)» patch (code needs review)
AttachmentSize
bootstrap-store-page-view.patch701 bytes

#6

morphir - January 29, 2007 - 14:12

now there is a patch.

AttachmentSize
bootstrap-store-page-view_0.patch701 bytes

#7

m3avrck - January 29, 2007 - 14:25
Status:patch (code needs review)» patch (reviewed & tested by the community)

Code looks good to me!

More reference on this directive here: http://www.httpsniffer.com/http/1409.htm#sec14.9.2

#8

m3avrck - January 29, 2007 - 14:26

Should be backported as well after this goes in.

#9

moshe weitzman - January 29, 2007 - 17:56
Status:patch (reviewed & tested by the community)» patch (code needs review)

this moved to RTBC with just a code review. Thats insufficient. We need testing. For example, if a user is anon and then logs into site, does he see stored page when revisiting an URL? that would be a bug.

#10

m3avrck - January 29, 2007 - 19:11

Moshe, maybe it wasn't clear from my post.

I posted a link to what the "store" directive means. It has nothing to do with caching the output of the page, it only affects information that is stored *about* the page.

For example, if you goto a page, enter some content in the forms, then navigate away and try and come back, all of the data is lost. Not only that, but your XY coords on the page are lost so it always puts you at the top.

This patch allows the browser to *store* this info, which greatly enhances the usability of Drupal.

It doesn't affect logging in/out. (and yes this has been confirmed by me, feel free to confirm my results though, but please notice how much more friendly the back button is now).

#11

Dries - January 29, 2007 - 19:25
Status:patch (code needs review)» fixed

I've committed this to CVS HEAD.

#12

m3avrck - January 29, 2007 - 19:29
Version:6.x-dev» 5.x-dev
Status:fixed» patch (reviewed & tested by the community)

Should be applied to 5.x as well. Probably even 4.7.x could see this too since the patch is trivial.

#13

drumm - January 31, 2007 - 07:06
Version:5.x-dev» 6.x-dev

#14

m3avrck - February 1, 2007 - 02:57
Version:6.x-dev» 5.x-dev

This was already committed in HEAD, it was never backported to 5, nor 4.7

#15

killes@www.drop.org - February 1, 2007 - 23:02

I am not sure this shoudl be backported. It causes Drupal to behave differently. Untill now, all pages would get reloaded, this is no longer the case. This is a rather big change in UI.

#16

m3avrck - February 1, 2007 - 23:07

It's a rather huge usability boost and makes Drupal work like all other websites :-)

It's a usability fix but it's really a bug fix---Drupal broke people's back button.

#17

Chris Johnson - February 6, 2007 - 12:17

I think this should be backported to D5 and 4.7. The change in behavior is non-destructive, and brings Drupal behavior more in line with what most people expect.

#18

drumm - February 7, 2007 - 07:46
Version:5.x-dev» 6.x-dev
Status:patch (reviewed & tested by the community)» patch (code needs work)

I think this might be okay for Drupal 5, but I think it needs to be fixed in 6 first.

Section 14.9, Cache control of RFC 2616, HTTP 1.1, has a list of cache response directives. 'no-store' is allowed, but 'store' is not mentioned. It might be a commonly used cache extension as specified in section 14.9.6, but we would have to show that some major browsers use it.

I think the 'store' bit can simply be omitted.

#19

fajerstarter - February 14, 2007 - 22:43

Could be worth noting that so far I've only seen the "non-store" behaviour in Firefox. Opera and IE6 remembers form and page states, and their back-buttons are as fast as ever. Only tested Windows browsers though. So potentially only Firefox is affected by this patch.

#20

moshe weitzman - February 14, 2007 - 22:51
Status:patch (code needs work)» patch (reviewed & tested by the community)

drumm is likely right, but i don't think thats sufficient reason to withhold this patch from backport. it has been deemed acceptable for HEAD, and loads of sites are sufferring without it. it is compleetly harmless to output a cache directive which is not implemented.

#21

alaa - April 29, 2007 - 13:20
Version:6.x-dev» 5.x-dev

discussion stopped two month ago. any strong reasons why this did not get backported to 5 yet?

#22

tesliana - May 1, 2007 - 02:07
Title:Store site view in HTTP headers» Is this not a show stopper ?!?

Everybody seemed to agree that current behaviour is totally unacceptable and then the whole issue went frozen cold. What gives ? Should such Drupal NON USABILITY not be treated as a showstopper ?

#23

m3avrck - May 1, 2007 - 02:14
Title:Is this not a show stopper ?!?» Store site view in HTTP headers

Please do not change the title, thanks.

#24

Dries - May 1, 2007 - 08:34
Title:Store site view in HTTP headers » Store site view in HTTP headers

tesliana: the patch was committed to Drupal HEAD thus it will be part of the next Drupal version. It has not been backported to Drupal 5 yet, but that's up to Neil (branch maintainer) to decide. We've to be careful that we don't break other modules/features by committing this patch.

#25

drumm - May 7, 2007 - 04:20
Status:patch (reviewed & tested by the community)» fixed

Committed to 5.

#26

Anonymous - May 21, 2007 - 04:30
Status:fixed» closed

#27

ChrisOwens - November 21, 2007 - 18:32
Status:closed» active

This breaks the download of file attachments using IE6 and IE7 when accessing the site via https

See
http://drupal.org/node/173697

See also
http://support.microsoft.com/kb/316431

#28

drumm - November 25, 2007 - 23:50
Status:active» duplicate

There does not need to be two tickets open for the same issue. Please use http://drupal.org/node/173697, which has more detail on this specific problem.

 
 

Drupal is a registered trademark of Dries Buytaert.