Pragma Header
Table of Content
- Syntax
- Directives
- Examples
- Browser Compatibility
- How to modify Pragma header The Pragma header is a specific piece of HTTP 1.0 headers used to define the browser's cache policies. This header predominantly served as a directive for backward compatibility with HTTP/1.0 caches where the Cache-Control HTTP/1.1 header is not yet present. This header is only supposed to be implemented in client requests but bears no resemblance to the responses' cache-control. However, the pragmatic use of Pragma header has largely been superseded by Cache-Control Header.
Syntax
Pragma: no-cache
Directives
The only directive used with the Pragma header is no-cache
. It was used for backwards compatibility with HTTP/1.0 as a way to preclude caching.
Examples
Below is an example of how to implement the Pragma header:
GET /index.html HTTP/1.1
Host: www.example.com
Pragma: no-cache
In this case, the client is requesting index.html
but also instructing the server not to use a cached version of the page.
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
How to modify Pragma header
ModHeader is a Chrome extension used for modifying HTTP requests headers. Using ModHeader to modify the Pragma header is as simple as adding a new header and setting its value.
- Open the ModHeader extension.
- Click on 'Add' under the 'Request headers' tab and a new row will appear.
- Input 'Pragma' in the 'Name' section and 'no-cache' in the 'Value' section.
This way, for every new client request, the Pragma header will be set to 'no-cache', instructing servers not to use cached versions of pages, thereby retrieving the freshest content.