Skip to content

Commit

Permalink
Merge pull request #137 from os2display/feature/2773_no_cache
Browse files Browse the repository at this point in the history
2773: Add no-cache directive
  • Loading branch information
turegjorup authored Oct 23, 2024
2 parents b797109 + 285f0d7 commit 4ca840c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .docker/vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ server {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://node:3000;
add_header Cache-Control "public, max-age=604800";
expires 7d;

add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
add_header Pragma "no-cache";
add_header Expires "0";
}

location /client/ws {
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.

## Unreleased

- [#137](https://github.com/os2display/display-client/pull/137)
- Add `no-cache´ directive to nginx setup.

## [2.1.0] - 2024-10-23

- [#135](https://github.com/os2display/display-client/pull/135)
Expand Down
7 changes: 5 additions & 2 deletions infrastructure/itkdev/etc/confd/templates/default.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ server {
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
index index.html;
autoindex off;
add_header Cache-Control "public, max-age=604800";
expires 7d;

add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
add_header Pragma "no-cache";
add_header Expires "0";

try_files $uri $uri/ =404;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ server {
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
index index.html;
autoindex off;
add_header Cache-Control "public, max-age=604800";
expires 7d;

add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
add_header Pragma "no-cache";
add_header Expires "0";

try_files $uri $uri/ =404;
}

Expand Down
6 changes: 3 additions & 3 deletions public/online-check/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

body {
background-color: #333333;
background-color: #000000;
margin-top: 10%;
text-align: center;
font-family: Arial,Helvetica,sans-serif;
Expand Down Expand Up @@ -71,7 +71,7 @@

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

setTimeout(async () => {
window.location.assign("../");
window.location.assign("../?ts="+ Date.now());
}, 3000
)
}
Expand Down
2 changes: 2 additions & 0 deletions src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ body {
color: white;
padding: 0;
margin: 0;
font-family: monospace;
font-size: 2em;
}

.bind-key-container {
Expand Down

0 comments on commit 4ca840c

Please sign in to comment.