Using META tag in HTML for setting response headers

As per Useful HTML META tags, HTML developer should be able to set the HTTP response headers by adding META tag in the HTML like this


<html>
<head>

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

<title>Caching test - second.html</title>
</head>
<body>
<a href='/perf/first.html'>Second HTML</a><br/>
<img src='/perf/images/cachesample.gif'/>

</body>
</html>


But we should never rely on this technique to set tag i tried serving this HTML from Apache Http Server as well as IBM's WebSphere Application Server and they dont set the response headers. Some of the browsers read the value of META tag and honor those values but its not very consistent.

The way it works is the HTML developer will generate these tags inside the document and then the server is supposed to read the HTMl response and parse it to find META tag's if it does then it is supposed to set corresponding HTTP headers but this adds performance penalty so its not guaranteed that every HTTP server will do that

2 comments: