-
TheBlueMatt commented at 9:46 pm on November 6, 2025: contributorit would be nice to serve appropriate cache headers in the REST interface so that you can just slap nginx/cloudflare in front of it and have a nice caching proxy. Eg getXbyheight requests would get cached for 5 seconds and getYbyhash requests could get cached for a month/year.
-
TheBlueMatt commented at 9:47 pm on November 6, 2025: contributor@achow101 said she’d work on this
-
DrahtBot added the label RPC/REST/ZMQ on Nov 7, 2025
-
waketraindev commented at 9:31 am on November 9, 2025: contributor
Cache-Control headers can be easily handled at the nginx layer. Rather than adding this logic directly in Bitcoin REST code, it might make sense to include a sample nginx config under contrib/ with reasonable defaults for REST endpoints.
0# Example include: rest-cache.conf 1location /rest/block/ { 2 # Cache block lookups by hash for a long time (immutable) 3 if ($uri ~ "^/rest/block/[0-9a-f]+\.json$") { 4 add_header Cache-Control "public, max-age=31536000, immutable"; 5 } 6 7 # Cache height-based lookups briefly (chain tip changes) 8 if ($uri ~ "^/rest/block/[0-9]+\.json$") { 9 add_header Cache-Control "public, max-age=5"; 10 } 11}This could be included in nginx
serverorlocationblocks to provide sensible defaults without changing the rest implementation itself.End users could then fine tune it as needed, for example adding rate limiting, conditional caching or more advanced cache key logic depending on their deployment setup.
Labels
RPC/REST/ZMQ
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-12 18:13 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-12 18:13 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me