Skip to content

Commit

Permalink
Merge pull request #78 from loics2/feature/azure3193-add-cache-control
Browse files Browse the repository at this point in the history
 [Feature] azure3193 - Add cache control
  • Loading branch information
sephii authored Dec 11, 2024
2 parents 5a13bbd + 052f479 commit 5a45f34
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ This project tries to follow [Semantic Versioning](http://semver.org/).

## Unreleased

## [0.9.15] - 2024-12-17

### Added

- Lib: add cache-control headers to the nginx configuration

## [0.9.14] - 2024-09-24

### Added
Expand Down
17 changes: 12 additions & 5 deletions lib/_nginx_cfg_https.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# $1: domain
# $2: https port
nginx_cfg_https_default() {
local domain=$1
local https_port=$2
retval="
local domain=$1
local https_port=$2
retval="
server {
listen $https_port ssl http2;
ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
Expand All @@ -24,14 +24,21 @@ server {
include conf.d/ssl_*.conf.inc;
}
# enable cache-control headers for assets
location ~* \.(js|css|jpg|jpeg|png|gif|ico|webp|avif|avifs)$ {
expires 1y;
etag off;
if_modified_since off;
add_header Cache-Control "public, no-transform";
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
auth_basic off;
root /usr/share/nginx/html;
}
}
"
echo "$retval"
echo "$retval"
}

0 comments on commit 5a45f34

Please sign in to comment.