iTwenty
iTwenty

Reputation: 973

Google Cloud Endpoints not respecting etag cache headers

When I issue a GET request, I get back a 200 OK and the etag header:

etag → "tZIZl_M15FKLVh9sN6Nj0iz1dQE/fA5Fya8Zz6DLGJwPNnIWbruyt30"

In my subsequent request, I send the

If-Not-Modified → "tZIZl_M15FKLVh9sN6Nj0iz1dQE/fA5Fya8Zz6DLGJwPNnIWbruyt30"

header, but the endpoint still sends back 200 OK rather than 304.

How do I get my endpoint to respect the If-Not-Modified header? Documentation on caching using cloud endpoints is non existent :/

Upvotes: 5

Views: 387

Answers (1)

Mario
Mario

Reputation: 1230

Google Cloud Endpoints is a mechanism to call your back-end methods directly.

Hence, they don't follow the normal rules for other requests, like the cache one you're mentioning.

Think of them like AJAX code for App Engine that can be called from your Android/iOS/web code.

You have two options if the cache is important for you:

  1. To use the standard HTTP request/response model, i.e. not to use Cloud Endpoints.
  2. To implement a cache control by yourself inside your own methods.

Upvotes: 2

Related Questions