Skip to content

Commit

Permalink
Add cache control
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkbatya committed Jul 19, 2023
1 parent 084e4f6 commit 210b402
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY startup.sh /app/
WORKDIR /app

RUN apk update
RUN apk add tzdata nginx-mod-http-fancyindex bash
RUN apk add tzdata nginx-mod-http-fancyindex nginx-mod-http-headers-more bash
RUN python3 -m pip install -r requirements.txt

CMD ["/bin/bash", "startup.sh"]
6 changes: 6 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ worker_processes 1;

error_log /dev/stdout info;
load_module "modules/ngx_http_fancyindex_module.so";
load_module "modules/ngx_http_headers_more_filter_module.so";
daemon off;

events {
Expand All @@ -17,10 +18,14 @@ http {
listen 80 default_server;
client_max_body_size 1024M;
location /builds/nginx-theme/ {
more_set_headers -s '200 201 204 206 301 302 303 304 307 308' 'Cache-Control: public, max-age=1209600, s-max-age=1209600';
more_set_headers -s '400 404 413 500 503' 'Cache-Control: no-cache, max-age=0, s-max-age=0, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0';
alias /var/lib/nginx/html/nginx-theme/;
}
location /builds {
root /files;
more_set_headers -s '200 201 204 206 301 302 303 304 307 308' 'Cache-Control: public, max-age=1209600, s-max-age=1209600';
more_set_headers -s '400 404 413 500 503' 'Cache-Control: no-cache, max-age=0, s-max-age=0, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0';
fancyindex on;
fancyindex_header "/nginx-theme/header.html";
fancyindex_footer "/nginx-theme/footer.html";
Expand All @@ -32,6 +37,7 @@ http {
fancyindex_ignore "nginx-theme";
}
location ~ ^/(qFlipper|firmware|blackmagic-firmware)/ {
more_set_headers 'Cache-Control: no-cache, max-age=0, s-max-age=0, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 120s;
Expand Down

0 comments on commit 210b402

Please sign in to comment.