Skip to content

Commit 4ca840c

Browse files
authored
Merge pull request #137 from os2display/feature/2773_no_cache
2773: Add no-cache directive
2 parents b797109 + 285f0d7 commit 4ca840c

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

.docker/vhost.conf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ server {
77
proxy_set_header X-Forwarded-For $remote_addr;
88
proxy_set_header Host $http_host;
99
proxy_pass http://node:3000;
10-
add_header Cache-Control "public, max-age=604800";
11-
expires 7d;
10+
11+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
12+
add_header Pragma "no-cache";
13+
add_header Expires "0";
1214
}
1315

1416
location /client/ws {

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7+
- [#137](https://github.com/os2display/display-client/pull/137)
8+
- Add `no-cache´ directive to nginx setup.
9+
710
## [2.1.0] - 2024-10-23
811

912
- [#135](https://github.com/os2display/display-client/pull/135)

infrastructure/itkdev/etc/confd/templates/default.conf.tmpl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ server {
77
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
88
index index.html;
99
autoindex off;
10-
add_header Cache-Control "public, max-age=604800";
11-
expires 7d;
10+
11+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
12+
add_header Pragma "no-cache";
13+
add_header Expires "0";
14+
1215
try_files $uri $uri/ =404;
1316
}
1417

infrastructure/os2display/etc/confd/templates/default.conf.tmpl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ server {
77
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
88
index index.html;
99
autoindex off;
10-
add_header Cache-Control "public, max-age=604800";
11-
expires 7d;
10+
11+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
12+
add_header Pragma "no-cache";
13+
add_header Expires "0";
14+
1215
try_files $uri $uri/ =404;
1316
}
1417

public/online-check/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919

2020
body {
21-
background-color: #333333;
21+
background-color: #000000;
2222
margin-top: 10%;
2323
text-align: center;
2424
font-family: Arial,Helvetica,sans-serif;
@@ -71,7 +71,7 @@
7171

7272
const checkOnlineStatus = async () => {
7373
try {
74-
const online = await fetch("1pixel.png?no_cache=" + Date.now());
74+
const online = await fetch("1pixel.png?ts=" + Date.now());
7575
return online.status >= 200 && online.status < 300; // either true or false
7676
} catch (err) {
7777
return false; // definitely offline
@@ -87,7 +87,7 @@
8787
helpDisplay.textContent = "Redirecting to client...";
8888

8989
setTimeout(async () => {
90-
window.location.assign("../");
90+
window.location.assign("../?ts="+ Date.now());
9191
}, 3000
9292
)
9393
}

src/app.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ body {
2727
color: white;
2828
padding: 0;
2929
margin: 0;
30+
font-family: monospace;
31+
font-size: 2em;
3032
}
3133

3234
.bind-key-container {

0 commit comments

Comments
 (0)