cache-handler icon indicating copy to clipboard operation
cache-handler copied to clipboard

Internal Server Error when caching file using nuts storage in Caddy

Open rwv opened this issue 5 months ago • 2 comments

When using Souin with the nuts storage backend in Caddy, everything works fine at first — files are served correctly, and Cache-Status headers appear in the response as expected.

However, after a short period of time (or a few refreshes), all files under the same domain become inaccessible, and subsequent requests start failing with a 504 Gateway Timeout. The issue seems to originate from the caching layer, possibly due to a corrupted or locked cache state.

This behavior is not limited to any specific file type — it affects static assets like .js, .data, and others.

Initial log entries show successful cache reuse, but later logs report internal server errors:

Logs:

caddy-1  | {"level":"info","ts":1754061121.7552905,"logger":"http.handlers.cache","msg":"Reused response from concurrent request with the key GET-https-example.com-/loader.js"}
caddy-1  | {"level":"info","ts":1754061121.7561495,"logger":"http.handlers.cache","msg":"Reused response from concurrent request with the key GET-https-example.com-/loader.js"}
caddy-1  | {"level":"info","ts":1754061298.822284,"logger":"http.handlers.cache","msg":"Internal server error on endpoint /wasm.data: [0xc000012840]"}

Caddyfile:

example.com {
    cache {
		ttl 600m
		nuts {
			path /var/cache/nuts
		}
	}

	reverse_proxy * {
		to http://backend
	}
}

rwv avatar Aug 01 '25 15:08 rwv