First, did you check the nginx-Configuration Tool? https://www.digitalocean.com/community/tools/nginx?global.app.lang=de
It is very handy for complex configuration scenarios.
Secondly, disable your weak chipers
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
by replacing
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
About your caching issue (Docs found here):
Did you follow the Docs? My Basic example works out of the box:
nginx -v
nginx version: nginx/1.18.0
The Header is set:
wget -S -O - http://example.com
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: nginx/1.18.0
Date: Wed, 01 Mar 2023 14:26:13 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 865
Connection: keep-alive
X-Proxy-Cache: HIT
Accept-Ranges: bytes
/etc/nginx/conf.d/test.conf
server {
server_name example.com;
listen 80;
listen [::]:80;
location / {
# Reverse Proxy
proxy_pass http://127.0.0.1:3000;
index index.html index.htm index.php;
limit_except HEAD GET POST {deny all;}
proxy_ignore_headers "Set-Cookie";
proxy_hide_header "Set-Cookie";
proxy_cache STATIC;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
}
}
/etc/nginx/nginx.conf
http {
##
# Basic Settings
##
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:10m;
The Cache folder:
$ /data/nginx/cache# ls
4 6 8 a b