Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test HEAD requests before GET #104

Open
hsanjuan opened this issue Jan 24, 2025 · 2 comments
Open

Test HEAD requests before GET #104

hsanjuan opened this issue Jan 24, 2025 · 2 comments

Comments

@hsanjuan
Copy link

The Trustless Gateway Spec requires supporting HEAD requests.

I have observed providers with HTTP-endpoint that return 500 on HEAD requests, while returning content with GET requests for the same URL.

It is important that HEAD requests are supported as it allows opportunistic content discovery without causing unnecessary load on the providers.

For example, in general we can use HEAD to test if multiple providers have the content they are announcing. We can then use GET to fetch according to latency measurements, or any scoring mechanism.

In the context of Spark, we can expand tests by checking the presence of many more CIDs and randomly picking which ones to fully retrieve.

@bajtos
Copy link
Member

bajtos commented Jan 24, 2025

Thank you for the suggestion, @hsanjuan.

As I understand it, you would like to add a third check to the existing two we have in place:

  1. The CID advertised to IPNI.
  2. [NEW] If the protocol is HTTP, the provider responds with 200 for a HEAD request.
  3. The root block of the content identified by CID can be retrieved and matches the hash in CID.

Is that correct?

@bajtos
Copy link
Member

bajtos commented Jan 24, 2025

To maintain backward compatibility, it may be better to run the HEAD check only if the retrieval check passes and also to report the outcome of HEAD checks as a new metric distinct from RSR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants