Http headers in GeneXus applications

Unofficial Content

Http Headers define a lot of characteristics of the data that is requested or provided in a HTTP comunication.

This document will explain how HTTP headers are managed in GeneXus generated applications, by focusing in two main points :

  1. HTTP headers automatically generated for the applications by GeneXus
  2. HTTP headers user-defined actions in GeneXus objects code.

HTTP headers automatic generation

Responses

The following HTTP headers are afected by the GeneXus generated application code :

  • Cache-control : the directives no-cache, no-store, must-revalidate and max-age=0 are included
  • Pragma : the value no-cache is included
  • Content-type : text/html value and charset value are set
  • Content-encoding : gzip value is set if HTTP compression is enabled

The previous list show which headers are used or modified automatically by GeneXus for the HTTP comunications, but it is important to remember that many other factor affect the HTTP responses headers, such as the web server type and configuration.

Another way to use or set a HTTP response header is using Http-equiv meta tags in the HTML code. These tags are use to include information in a HTML document header and this information can affect the creation of the HTTP header. GeneXus automatically generate some Http-equiv tags in the applications:

  • Page-Enter : used to set tha transition type between the web pages (Blend Trans value is used)
  • X-UA-Compatible : compatibility information used when executing in IE8
  • Content-type : If some conditions occurs, the content type is set again in the document
Requests

The HTTP requests headers are also configured automatically with some values by GeneXus generated code, but, again, it is important to remember that other factor can affect the HTTP headers, like browser type or configuration.

Request headers affected by GeneXus are :

  • Content-type : the value set depends of many things, for example call type (ajax) or blobs in form usage
  • GxAjaxRequest : request type
  • AJAX_SECURITY_TOKEN : security parameter used in the request
  • GxTZOffset : Current TimeZone

HTTP headers manual handling

Users can add HTTP communications functionalities in their Knowledge Base objects in GeneXus.
Some data types, methods and functions are provided for this purpose.

Take into consideration that some proxies (such as Juniper) as default configuration filter non standard headers; this will cause wrong behavior when executing a GeneXus application.

The available data types are :

These data types provide many properties and methods to handle the HTTP comunication, including header usage.

On the other hand, Http-equiv tags in Web form headers can be handled inside the GeneXus object code too, throught the Form.MetaEquiv element in any Web Panel or Transaction.

References

Http Headers definition
Http Headers (Wikipedia resumed list)

HTTP traffic analysis tools:

Web Sniffer
Fiddler