views:

52

answers:

1

I would like to create a cacheable HTTP response for a POST request.

My actual implementation responses the following for the POST request:

HTTP/1.1 201 Created
Expires: Sat, 03 Oct 2020 15:33:00 GMT
Cache-Control: private,max-age=315360000,no-transform
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 9
ETag: 2120507660800737950
Last-Modified: Wed, 06 Oct 2010 15:33:00 GMT

.........

But it looks like that the browsers (Safari, Firefox tested) are not cacheing the response.

In the HTTP RFC the corresponding part says:

Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent to retrieve a cacheable resource.

So I think it should be cached. I know I could set a session variable and set a cookie and do a 303 redirect, but I want to cache the response of the POST request.

Is there any way to do this?

P.S.: I've started with a simple 200 OK, so it does not work.

Thanks,

A: 

Can you try to change the Cache-Control to public instead of private and see if it's working?

Nir Levy
i'll try but the content should not be cached publicly
KARASZI István
unfortunately not working either
KARASZI István