A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/304 below:

304 Not Modified - HTTP

The examples below show GET requests made using curl with conditional request headers. The --http1.1 flag is used to force the HTTP/1.1 protocol for readability.

The first request uses an If-Modified-Since condition with a future date of 21st November 2050. This must evaluate to false, because the resource can't have been updated after a time that hasn't happened yet:

curl --http1.1 -I --header 'If-Modified-Since: Tue, 21 Nov 2050 08:00:00 GMT' \
 https://developer.mozilla.org/en-US/

This will result in the following HTTP request:

GET /en-US/ HTTP/1.1
Host: developer.mozilla.org
User-Agent: curl/8.7.1
Accept: */*
If-Modified-Since: Tue, 21 Nov 2050 08:00:00 GMT

The response would be 200 OK with the current version of the resource if the resource had been updated after the timestamp in the If-Modified-Since header. Instead, we get a 304 response that includes ETag, Age and Expires headers, telling us our cached version of the resource is still current:

HTTP/1.1 304 Not Modified
Date: Wed, 28 Aug 2024 09:52:35 GMT
Expires: Wed, 28 Aug 2024 10:01:53 GMT
Age: 3279
ETag: "b20a0973b226eeea30362acb81f9e0b3"
Cache-Control: public, max-age=3600
Vary: Accept-Encoding
X-cache: hit
Alt-Svc: clear

Now run another curl command using the etag value from the previous response with the If-None-Match condition (since this etag is the current version of the resource on the server we expect to receive a 304 Not Modified response):

curl --http1.1 -I --header 'If-None-Match: "b20a0973b226eeea30362acb81f9e0b3"' \
 https://developer.mozilla.org/en-US/

This will result in the following HTTP request:

GET /en-US/ HTTP/1.1
Host: developer.mozilla.org
User-Agent: curl/8.7.1
Accept: */*
If-None-Match: "b20a0973b226eeea30362acb81f9e0b3"

Because the etag value matches at the time of the request, the entity tag fails the condition, and a 304 response is returned:

HTTP/1.1 304 Not Modified
Date: Wed, 28 Aug 2024 10:36:35 GMT
Expires: Wed, 28 Aug 2024 11:02:17 GMT
Age: 662
ETag: "b20a0973b226eeea30362acb81f9e0b3"
Cache-Control: public, max-age=3600
Vary: Accept-Encoding
X-cache: hit
Alt-Svc: clear

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4