hashicorp / hashicorp/consul

Idea for a PR: Leverage HTTP libraries Caching with ETag and If-None-Match headers

Open
#3,871 3 comments 3 reactions 0 assignees View on GitHub
theme/api thinking type/enhancement type/umbrella-☂️
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

In order to ease Consul integration with browers, I was wondering whether it would be a good idea to use ETag and If-None-Match HTTP Headers withing the HTTP Headers:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match

Since X-Consul-Index is already a kind of ETag, by addiing a kind of ETag to Consul, it would allow to leverage cache mechanisms of browser or HTTP libraries to perform polling using HTTP caches.

If each endpoint would issue a simple ETag header, the browser would then query the API with a If-None-Match and would get a HTTP 304 if the endpoint did not change (without returning the body).

Thus, the performance over HTTP would increase for GUIs using the Consul API and it would be more standard regarding the HTTP behavior. It would not modify the polling mechanism, but would help a lot creating well performing GUIs using HTTP Consul APIs.

I can perform a PR if you are interested with such change

Regards

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.