Rails 4.0.3 / unicornの下にブドウのAPIがあります。
curl でリクエストを行うと、返された「etag」が欠落しているようです。しかし、「swagger UI」で同じことを行うと、etag が存在し、次のリクエストでもキャッシュが機能します。
ブラウザ内:
-最初のリクエスト:
Status Code:200 OK
Cache-Control:max-age=0, private, must-revalidate
Connection:keep-alive
Content-Encoding:gzip
Content-Type:application/json
Date:Tue, 24 Jun 2014 18:43:09 GMT
Etag:"42ab9ced8f83b39e29775b0ca9cc5a6d"
-第二の要求:
Status Code:304 Not Modified
Cache-Control:max-age=0, private, must-revalidate, no-transform
Connection:keep-alive
Date:Tue, 24 Jun 2014 18:43:25 GMT
Etag:"42ab9ced8f83b39e29775b0ca9cc5a6d"
Status:304 Not Modified
これは私が受け取ったヘッダーであるため、curl でこれらすべてを確認することはできません。
curl -I --header "Authorization:d0294f288597e5979a5655a70ec63b88e" http://.../products.json
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-length: 586957
Content-Type: application/json
Date: Tue, 24 Jun 2014 18:53:34 GMT
Status: 200 OK
Vary: Accept-Encoding
X-Request-Id: 89ec37ea-e675-4c24-8c16-0f2338aafe81
X-Runtime: 0.496127
Connection: keep-alive
アプリケーションのルートに対して curl リクエストを行うと、ETAG が返されます。
curl -I --header "Authorization:d0294f288597e5979a5655a70ec63b88" http://...
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-length: 3359
Content-Type: text/html; charset=utf-8
Date: Tue, 24 Jun 2014 18:54:13 GMT
Etag: "c9198615bdab1e5ef77bfb9a6890f576"
説明は大歓迎です...ブドウがcurlのETAGを削除しているようです...(ただし、これは起こり得ません...明らかに...)