We have moved to Github. Please open tickets there.

Opened 4 years ago

Closed 3 years ago

#1261 closed Defect (fixed)

Elgg exception page can stay in proxy/client caches

Reported by: milan Owned by:
Priority: normal Milestone: Elgg 1.7
Component: Core Version: 1.6
Severity: minor Keywords:
Cc: marcus, brettp, Difficulty:

Description

Within elgglib.php, elgg_php_exception_hander
The message displayed to the user by default is set to cache for 10 years i.e.

Cache-Control: max-age=315360000

by changing elgg_php_exception_hander() to:

function __elgg_php_exception_handler($exception) {

	error_log("*** FATAL EXCEPTION *** : " . $exception);
	
	ob_end_clean(); // Wipe any existing output buffer
	
	// make sure the error isn't cached be browsers and proxies
	header("Cache-Control: no-cache, must-revalidate", true); // HTTP/1.1
	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT", true); // Date in the past	
	header("Internal Server Error", true, 500);
 
	$body = elgg_view("messages/exceptions/exception",array('object' => $exception));
	page_draw(elgg_echo('exception:title'), $body);
	
}

This way after the exception has been fixed the displayed exception will not be cached as most good browsers/proxies will respect the controls.

Change History (1)

comment:1 Changed 3 years ago by brettp

  • Resolution set to fixed
  • Status changed from new to closed

(In [svn:3884]) Fixes #1261: Exceptions force an HTTP recache.

Note: See TracTickets for help on using tickets.