r/programming • • Jul 14 '26

HTTP gets a QUERY method so complex searches can stop pretending to be POST

https://www.theregister.com/devops/2026/07/13/http-gets-a-query-method-so-complex-searches-can-stop-pretending-to-be-post/5270192
1.9k Upvotes

245 comments sorted by

View all comments

21

u/BuriedStPatrick Jul 14 '26 edited Jul 15 '26

Does anyone know why we haven't simply adopted request bodies in GET? I just don't see the point of QUERY.

EDIT:

Okay, here are some of the arguments, I'm still not convinced.

Proxies might not support it: If anyone has any practical examples of this being an issue it would be appreciated. I haven't ever encountered a problem here, but I also don't work with ancient software. But if they throw away GET bodies, what do we think will happen with QUERY methods?

HTTP client libraries don't support it: Well, they don't support QUERY either. Work has to be done either way, why not improve GET instead?

Backend server libraries don't support it: Same argument as client libraries.

This is a breaking change: Is it? It's just not been formalized AFAIK. You can absolutely send bodies in GET requests today. What exactly are we breaking here? If anything, this is simply an addition, like QUERY would be.

I'm just a basic backend dev with no experience managing anything on this scale trying to follow the spec. I'm just looking at it and thinking that something is completely off here from an application development perspective. I'm glad we're getting something to support the use case (tired of encoding/decoding base64 JSON in GET uri params). I just wish it would be under GET.

44

u/masklinn Jul 14 '26

Because the RFC says they are irrelevant so proxies, servers, and middleboxes commonly drop them for one reason or another, making GET entity-bodies highly unreliable.

5

u/edgmnt_net Jul 14 '26

It does not, as far as I know, the HTTP RFC says nothing about it. However web standards say the JS API doesn't like GET bodies. Additionally web forms provide no way to serialize parameters into the body of a GET request. It's more likely a case of web standards and implementations assuming too much, as is the case with SCTP being broken in the wild due to crappy firewalls.

18

u/masklinn Jul 14 '26

It does not, as far as I know, the HTTP RFC says nothing about it.

RFC 9110 section 9.3.1 GET

content received in a GET request has no generally defined semantics, cannot alter the meaning of target if the request, and might lead some implementations to reject the request and close the connection

“Content” in RFC 9110 is what RFC 7231 calls “payload”, and older RFCs called entity. The above is an expansion of RFC 7231:

A payload within a GET request has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.

RFC 2616 does not say anything about GET request entities, but it specifically mentions them when describing any method for which they are (PUT, POST) or may be (OPTIONS) relevant, from this implementers interpreted unspecified bodies as irrelevant and discardable (GET, HEAD, DELETE), which the later RFCs went on to specify.

2

u/Jaggedmallard26 Jul 14 '26

HTTP RFC says nothing about it

If behaviour isn't defined then implementers are free to do whatever they want with it including dropping it. Which they often do.

0

u/edgmnt_net Jul 14 '26

That's not reasonable at all. What do you propose proxies or web servers do when they receive FOO methods (replace with PROPFIND or QUERY for actual stuff)? Should they also discard those just because they don't know about them and break all potential applications using custom / yet unknown methods? I see no viable interpretation under which FOO is more "defined" than GET with a body. And the only place where it makes sense to discard stuff is if you consider the entire system end-to-end, e.g. it's perfectly fine if a final endpoint does not know what FOO means and discards it, but this is not the case for general proxies or general web servers. Or, ok, specific proxies could implement GET & POST-based policies and discard everything else, but that needs to be tweakable or it's on you to deal with it.

1

u/BuriedStPatrick Jul 14 '26

This is my thinking as well and why I'm asking. I get that there can be some theoretical worry there and I'm not a protocol expert. It just seems to me that if we were to start from scratch then bodies would be part of GET and we wouldn't have a separate method. It seems very inelegant and hacky to me to add QUERY as an afterthought.

Furthermore, I know ElasticSearch has historically supported request bodies in GET requests. And I struggle to come up with any proxies I've used that don't support it.

I know several HTTP libraries that don't explicitly support it, but nothing is stopping them from adding it or you from modifying the outgoing request manually. So it seems rather trivial from a practical perspective.

1

u/stronghup Jul 15 '26

I think its better to a have a well-defined standard, QUERY, instead of assuming that some servers and proxies might support a form of GET that lets you have a body. And it's nice to know I don't have to "misuse" POST just to be sure I can send a body.

2

u/BuriedStPatrick Jul 15 '26

I get that, but I guess I just don't think QUERY is a well-defined standard since it muddles and absolutely overlaps with GET. Filtering results with GET URI parameters has always been a thing. So the query use case is clearly part of GET as well.

And at least right now, there's no guarantee that QUERY will work either, especially on older infrastructure. So some work will always be needed regardless. I suppose I'd just rather have GET improved instead.

0

u/edgmnt_net Jul 14 '26

Yeah, that's what I'm thinking too. Besides, QUERY might be ineffective if we consider legacy, broken stuff that might just drop it altogether. Might as well add some sort of an extra header to POST requests that says "this is more of a GET, you can cache it if you know about this", which is less likely to cause issues.

1

u/Ouaouaron Jul 14 '26

Does it matter if it's reasonable? If Internet infrastructure breaks GET bodies more frequently than FOO bodies, then people are going to use FOO.

1

u/edgmnt_net Jul 14 '26

Sure but that's actually an open question for me. Do any of the other lesser-known methods work properly under such conditions? Say stuff like PROPFIND. What makes us think QUERY is going to work with all that broken stuff?

Secondly, unlike Internet infrastructure that's on lower levels, this stuff seems somewhat better confined. An ordinary user is going to hit lower level stuff all the way to the website, but is unlikely to see ISP level or intermediate nodes doing HTTP caching. Ordinary flows are much more likely to hit a cache related to some cloud service or final endpoint, with the possible exception of corporate networks. But all of those are easier to fix than fixing the lower level Internet infrastructure, which is ossified in different ways.

And even if you're right, then why not continue using POST and simply add a header to declare caching? That has a lower potential of breaking things than a new method.

6

u/Cvballa3g0 Jul 14 '26

No explicit handling for it. So QUERY is the adoption. Preserves current behavior and adds new explicit specs

1

u/BuriedStPatrick Jul 14 '26

I suppose I just don't see why the adoption was handled this way. Current behavior doesn't seem very explicitly defined. AFAIK nowhere does it say GET should not support request bodies, and I've worked with clients and servers that have used them with little issue. So wouldn't this be an opportunity to solidify how GET should handle bodies instead?

But I'm also just a lowly backend dev, don't spend a lot of time reading RFCs and such. Just seems like, if we were to start from scratch, GET would explicitly support bodies and we wouldn't be talking about QUERY at all.

3

u/Cvballa3g0 Jul 14 '26

But that would be the more risky path. And need to make sure implementation X, Y, Z are all aligned and doesn't break. undocumented behavior is tough when the Internet is running on old boxes

3

u/TinyBreadBigMouth Jul 14 '26

Avoids backwards compatibility issues with any infrastructure that assumes GET bodies can be treated as meaningless, as allowed in the spec:

Although request message framing is independent of the method used, content received in a GET request has no generally defined semantics, cannot alter the meaning or target of the request, and might lead some implementations to reject the request and close the connection because of its potential as a request smuggling attack. A client SHOULD NOT generate content in a GET request unless it is made directly to an origin server that has previously indicated, in or out of band, that such a request has a purpose and will be adequately supported. An origin server SHOULD NOT rely on private agreements to receive content, since participants in HTTP communication are often unaware of intermediaries along the request chain.

1

u/GarlandGreen Jul 16 '26

I'm not privy to the decisions, but I imagine there'd be utter chaos if they standardized this. Right now, GET is implemented in two ways. The standardized no-body method, and the unsanctioned "fat GET". How the latter handles changing state is probably different between several implementations. As such, implementing caching for fat GET would be inconsistent at best. Introducing a third way, a sanctioned "fat GET" would not help the caching situation. As the providers could ignore the body, have it change their state, or treat it as an idempotent call, depending on which historical implementation was chosen by the provider.

You could say that the burden lies on the implementer, which would probably be right, but the reality would be mayhem in intermediary caching regardless.