Skip to content

Commit

Permalink
gateway: switch only-if-cached miss to 412
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Jun 9, 2022
1 parent 4156b43 commit 5435910
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions http-gateways/PATH_GATEWAY.md
Expand Up @@ -136,9 +136,13 @@ gateway already has the data (e.g. in local datastore) and can return it
immediately.

If data is not cached locally, and the response requires an expensive remote
fetch, a 504 (Gateway Timeout) status code should be returned.
fetch, a 412 Precondition Failed HTTP status code should be returned by the
gateway without any payload or specific HTTP headers.

The code 412 is used instead of 504 because only-if-cached is handled by the
gateway itself, moving the error to client error range and avoiding confusing
server errors in places like the browser console.

See [RFC7234#only-if-cached](https://datatracker.ietf.org/doc/html/rfc7234#section-5.2.1.7)
<!-- TODO: https://github.com/ipfs/go-ipfs/issues/8783 -->

### `Accept` (request header)
Expand Down

0 comments on commit 5435910

Please sign in to comment.