Webmaster.Info
  Home
  AOL Client
  AOL Network
  Netscape Gecko
  Cookies
  HTTP Headers
  P3P
  Security
  FAQ
  Glossary
  Postmaster@AOL
  DNS@AOL

Vary Header Info

Caching | Connectivity | Proxy Info | Vary Header Info

Webmasters who wish to serve different content for different browsers should use the ""Vary:"" header to specify the set of request-header fields used in making the determination.

If you are using your application to serve different code to different useragents, we recommend you set your web server to respond with the ""Vary:"" Header. This will ensure that all HTTP/1.1 Proxy servers will serve the proper content to your users. If you are simply using JavaScript after the page has been downloaded then the actual page downloaded will be the same for each useragent.

If, for example, you wish to serve content in different languages, use ""Vary: Accept-Language"". When serving content based on web browser, use ""Vary: User-Agent"". Section 14.44 of the HTTP/1.1 RFC details the use of the ""Vary:"" header.

Sample NSAPI code for Netscape Enterprise Server 3.x (NT):

/* ******************************
* rheader.c ---> rheader.dll
* ******************************
*
* This script sets a Response Header for the specified object.
*
* At the beginning of obj.conf add:
*     Init fn=""load-modules"" shlib=""rheader.dll"" funcs=""rheader""
*
* In an add:
*     ObjectType fn=""rheader"" name="""" value=""""
*
* For Example:
*     ObjectType fn=""rheader"" name=""Vary"" value=""User-Agent""

#ifdef XP_WIN32
#define NSAPI_PUBLIC __declspec(dllexport)
#else /* !XP_WIN32 */
#define NSAPI_PUBLIC
#endif /* !XP_WIN32 */

#include ""nsapi.h""
#include ""base/pblock.h""
#include ""base/session.h""
#include ""frame/req.h""
#include ""base/util.h""
#include ""frame/protocol.h""
#include
#include ""frame/log.h""

#ifdef __cplusplus
extern ""C""
#endif


NSAPI_PUBLIC int rheader(pblock *param, Session *sn, Request *rq) {

char *name = pblock_findval(""name"", param);
char *value = pblock_findval(""value"", param);

pblock_nvinsert(name, value, rq->srvhdrs);
return REQ_PROCEED;
}