3 ms·
I'm not sure I understand why this needs to be standardized. Is there something that middleboxes and CDNs need to do with messages marked idempotent? Would a st
by tptacek 5y ago
I'm not sure I understand why this needs to be standardized. Is there something that middleboxes and CDNs need to do with messages marked idempotent? Would a standard header enable browsers to do something new that they're all likely to actually do? Otherwise: HTTP already specifies a bag-of-attributes header system, and this is just an application of it. Why is it in the HTTP standards?
- chalst 5y agoThis is potentially of interest to any application making use of POST. Its generality and simplicity justifies standardisation.
- tptacek 5y agoThe concept is worth knowing about, but that doesn’t mean it belongs in the standard, especially since there’s more than one way to do it. I’m wondering if someone knows a particular reason why this way needed to be standardized.
- mst 5y ago"Providing one solid way to do it to act as a co-ordination point" seems like a reason that could at least be argued, but without asking the authors I have no more insight than that, sorry.
- grishka 5y agoA real-world example from my previous job. You have a chat in your mobile app. Messages are sent using HTTP requests, and received using HTTP long polling. Now imagine sending a message over a slow network while on a departing subway train (service is only at stations). TCP & SSL are established successfully, then the request itself is sent, but you leave the network coverage before you receive the response. So you have no idea whether the message was actually sent. When you reconnect at the next station, you receive a message over long poll, but — because the request failed as far as you're concerned — you have no idea whether it's the message you sent. To resolve this, you need to have the ability to ask the server for a response to a previous request, but without actually performing that request a second time. Or, alternatively in this particular case, you need the server to accept a unique client-generated ID in the request and return it to you over long poll.
- quesera 5y agoThat's one valid use of an idempotency token. Also e.g. POST submission of an order or transaction. But these are implementation-specific, and available (and in active use) today under a few common HTTP header names. It's not clear why the header name should be standardized. You could move idempotency implementation up to the load balancer or the proxy layer. I'm not convinced that would be useful, because to implement the hard parts of idempotency (esp across instances), you'd need to add a bunch of extra complexity there, which is already a committed cost at the application layer. But if, say, haproxy or nginx release a new distributed idempotency caching feature, maybe that would change my mind.
- ec109685 5y agoAll that layer really needs to do is support caching objects. When response is returned, cache based on idempotent cache key, and on subsequent requests, lookup that value before making downstream requests. Also, should extend the key’s value with an unguessable session id, so folks can’t can’t guess the key and read someone else’s data.
- quesera 5y agoYep, but that idempotency caching layer would need to share keys across all instances, possibly even geographically. This is a solved problem at the application layer of course, but adding complexity at the higher (LB or proxy) layer ... well, adds complexity there and the benefit is not clear to me.
- tptacek 5y agoI think you're misunderstanding my question. I understand why idempotency tokens are valuable. What's not clear to me is why HTTP would need an "official" idempotency token. The behavior of APIs that run over HTTP is not properly part of the HTTP specification.
- aenis 5y agoMaybe to make it easier for people to understand the concept - and reinforce a good design pattern? I implemented this stuff my own way whenever I needed it (e.g., for a chatbot), and every time i needed to take the time to explain it to the client app dev teams. Sometimes it took longer than desired, and pointing them to a well written RFC would help.
- quesera 5y agoSeems like a tail wag. The header is in common use in APIs in the wild, so IETF wants to formalize it. Not unreasonable, but doesn't seem to add much value either. With standardization, load balancers or reverse proxies could add a limited idempotency guarantee to reduce the load/implementation cost on the application layer. I don't think anyone is asking for this though, nor do I think they should be...but maybe I'm wrong about that. "Free (quasi) idempotency for small environments" could be a feature.
- lilyball 5y agoBesides providing a standard set of behaviors so people don’t accidentally mishandle idempotency in their hand-rolled attempt, it also allows networking frameworks to build in support for this in a generic fashion (if there’s any particular behavior they want to do around idempotency). This isn’t for browsers doing browser things, it’s for API clients calling APIs.