News for hackers. Stuff that matters.
Re:Your Cache Headers Could Probably be More Aggressive by jrochkind1 on Thursday September 21, 2023 @08:27AM (#37596605)
That is... not right.

While POST is effectively never cached, GET can be. Cache headers should be set properly on GET responses, indicating desired caching behavior (which is more than 'on' or 'off', as the OP gets into), on any content, static or not.

The fundamental difference between GET and POST in http is idempotency. An non-cacheable response to an idempotent request is sometimes a (intentional, desirable) thing, which is why you can make GET responses non-cacheable if you want.

Static content isn't the only thing you might want to be cached, there are all sorts of use cases for caching (which again can be configured in many ways, it's not just on or off) for non-static content.

Re:Your Cache Headers Could Probably be More Aggressive by SkyPuncher on Thursday September 21, 2023 @09:04AM (#37597029)
While you’re right in theory, it doesn’t always work in practice. Some systems fail to respect caching headers.

Further, in my experience, intermediate caches are mostly useless for non-binary product data. Either you need to make a round trip or you don’t. Sure, you can cache and return “not changed”, but you still get the latency. Just returning the data often isn’t much slower.

POST avoids all of those issues by pretty much saying “give us what we neeed every time”

Re:Your Cache Headers Could Probably be More Aggressive by thejazzman on Thursday September 21, 2023 @08:40PM (#37606447)
> Some systems fail to respect caching headers.

Don't we call those bugs? http has a pretty well defined spec?

Re:Your Cache Headers Could Probably be More Aggressive by SkyPuncher on Thursday September 21, 2023 @09:20PM (#37606712)
Customers don't care what's defined in the spec. They care how it works.
Re:Your Cache Headers Could Probably be More Aggressive by jrochkind1 on Friday September 22, 2023 @09:58AM (#37612142)
By that logic, would you write a web site where every link was actually a POST unless it was to "static content"? That would be a disaster, no?

I guess the person I was replying to, and you, were talking about Javascript API calls rather than ordinary HTML executed by a "browser". It still seems like a wrong idea to me, but if this is what you do on actual apps and have success, I guess that's a thing.