Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :/

like image 966
iTwenty Avatar asked Oct 31 '22 09:10

iTwenty


1 Answers

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.
like image 56
Mario Avatar answered Nov 15 '22 07:11

Mario