http-header : pragma

This is a HTTP/1.0 general header. It is classified as an implementation-specific header which may have diverse effects along the request-response chain. This header is used for backwards compatibility with HTTP/1.0 caches in situations when the Cache-Control HTTP/1.1 header is not yet present.

Pragma is regarded as implementation of HTTP/1.0 while cache-control is regarded as the implementation of HTTP/1.1 where both belong to the same concept. Both are helpful as in preventing a client from caching the response. This header is still used as the older clients might not have HTTP/1.1 support.

If a request message holds a no-cache directive, an application must by all means forward the request to the origin server even though it holds a cached copy of what exactly is requested. This directive of pragma indicates same semantics as the no-cache cache-directive, and is said to be defined here due to backward compatibility with HTTP/1.0. The clients must consider or involve both the header fields while a no-cache request is being sent to any server which is not known to be compliant with HTTP/1.1.

Regardless of the significance of Pragma directives to a application, they should be passed via by the proxy or the gateway application, which is because the directives may be applicable to all the recipients along request/response chain. Specifying a pragma specific to a recipient is impossible; nonetheless, any directive of pragma which is irrelevant to any recipient must be duly ignored by that particular recipient.

The header, “Pragma: no-cache” must be treated by HTTP/1.1 caches must in a way as if the client had actually sent the header, “Cache-Control: no-cache”. There would be no more definition of new Pragma directives in HTTP.

Enablement in Apache:

The below given syntax is added in “http.conf” file.

Header set Pragma “no-cache”

Or, the following line is added in the “.htacces” file.

Header set Pragma “no-cache”

Enablement in Nginx:

The following mentioned syntax is added to the server’s configuration file.

add_header Pragma “no-cache”;

 

Follow us :
Please follow and like us:
0