Skip to content

Commit 9983003

Browse files
committed
Re-added caching to the htaccess file and fixes #94 by making the browser not store the html or js
1 parent e3cedd7 commit 9983003

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.htaccess

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ RewriteRule ^ index.php [L]
3333

3434
# Set max-age one year in the future for all static assets
3535
# Allow caching for all assets
36-
#<FilesMatch "\.(js|css|png|jpg|html)$">
37-
# Header set Cache-Control "max-age=29030400, public"
38-
# Header unset ETag
39-
# FileETag None
40-
# ExpiresActive On
41-
# ExpiresDefault A29030400
42-
#</FilesMatch>
36+
<FilesMatch "\.(js|css|png|jpg|html)$">
37+
Header set Cache-Control "max-age=29030400, public"
38+
Header unset ETag
39+
FileETag None
40+
ExpiresActive On
41+
ExpiresDefault A29030400
42+
</FilesMatch>

inc/databaseConn.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
// Bring in the config data
1212
require_once dirname(__FILE__) . "/config.php";
1313

14+
15+
// There is no better place to put this, as all pages require this file.
16+
//
17+
// Never cache or store any api call/page load as reopening pages
18+
// that are served differently by the api (e.g. /schedule/:hexcode)
19+
// depending if the "Accept" header has application/json
20+
// in it or not. The browser does not factor this in into
21+
// loading the page from cache, so the browser will load the json response
22+
// or html response for the same url even though there are very different.
23+
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
24+
1425
// Make a connection to the database
1526
global $DATABASE_SERVER, $DATABASE_USER, $DATABASE_PASS, $DATABASE_DB;
1627
$dbConn = mysql_connect($DATABASE_SERVER, $DATABASE_USER, $DATABASE_PASS);

0 commit comments

Comments
 (0)