Ted
Ted

Reputation: 3875

cURL - getting 200 OK instead of a 304 in my browser

I am using cURL to trace HTTP headers.
My browser says the resource got a 304 response.
In my cURL, I see a 200 OK.
Would you know why this could be ?

Upvotes: 1

Views: 3790

Answers (2)

Maxim Krizhanovsky
Maxim Krizhanovsky

Reputation: 26699

304 means Not Modified and is send in response of requests that contain If-Modified-Since header. Such header is send by the browser for cached resources, but curl does not send it

Upvotes: 1

ThiefMaster
ThiefMaster

Reputation: 318508

"304 Not Modified" means the resource is the same like when the browser requested it before (e.g. based on modification date or etag).

Curl has no cache so it will always request the resource without any "if-modified-since" header (and similar ones) - thus the server will send it together with a "200 OK" statuscode.

Upvotes: 9

Related Questions