gateway: ipld.ErrNotFound should result in a 404
It's a somewhat rare case, but it's possible for a gateway backend to return ipld.ErrNotFound:
- using an offline exchange, for example with
--offlinein kubo - possibly https://github.com/ipfs/kubo/blob/master/docs/config.md#gatewaynofetch
- implementing some form of denylist or restriction at the storage/exchange level (which we do at Infura)
In those situations, kubo v0.22.0 / boxo v0.11.0 would return a 404 in the gateway, but the implementation rework changed that to return a 500.
See also https://github.com/ipfs/boxo/pull/440/files#r1297472794
I think 404 is the correct answer, as this is not a timeout while looking for content on the p2p network, or some missing link in an IPLD node (which would mean an incorrect request). It's a definitive answer that the content does not exist.
Optionally, another status code could be returned in some more specific situations (see https://github.com/ipfs/boxo/issues/591), but 404 seem to be the correct default to me.
https://github.com/MichaelMure/boxo/commit/d088e1ea7664f04bd90e20ee3ec8a9ba4147a178 trivially change that returned status, with no other impact as far as I can tell.