caddyserver / caddyserver/cache-handler

Internal Server Error when caching file using nuts storage in Caddy

Open
#130 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
393
Forks
28
Avg merge
32m
Merged PRs (30d)
1

Description

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
	}
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided Caddyfile, the nuts storage path, and requests for static assets such as /loader.js and /wasm.data. Inspect the cache-handler path that logs concurrent-response reuse and internal server errors; done means repeated requests continue serving files without 504 Gateway Timeout responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.