HTTP headers | Pragma

The Pragma is a no-cache general-type CORS-safe listed response header field in an HTTP/1.0 header which is intended to use in the request-response chain. A pragma header meant to prevent the client from caching the response, pragma means the browsers to tell the server and any intermediate caches that it wants a fresh version of the resource and vice-versa is not true.

Note: Pragma is not specified for HTTP responses that’s why it is not a reliable replacement for the general HTTP/1.1 Cache-Control header. It is used only for backwards compatibility with HTTP/1.0 clients.

Difference between Pragma and Cache-control headers: The Pragma is only defined as applicable to the requests by the client, and the Cache-Control may be used by both the requests of the clients and the response of the servers.



Syntax

Pragma: no-cache

Directives: It is same as Cache-Control: no-cache header. It forces the caches to submit the request to the origin server for validation before releasing a cached copy.

Example:

Pragma: no-cache

To check the Pragma in action go to Inspect Element -> Network check the header for Pragma like below. Pragma header is highlighted.

Browser Compatibility: The browsers compatible with Pragma header are listed below:

  • Google chrome 6.0 and above
  • Internet Explorer 9.0 and above
  • Firefox 4.0 and above
  • Opera 11.1 and above
  • Safari 5.0 and above
  • Samsung Internet


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.