Vely logo install
examples
documentation

Vely 15.2.0 released on Jan 18, 2023
Articles updated Jan 17, 2023

out-header


Issues with this documentation page? Report here.

Purpose:


Output HTTP header.

Syntax:



out-header default

out-header use \
    [ content-type <content type> ] \
    [ download ] \
    [ etag ] \
    [ file-name <file name> ] \
    [ ( cache-control <cache control> ) | no-cache ] \
    [ status-id <status id> ] \
    [ status-text <status text> ] \
    [ custom <header name>=<header value> [ , ... ] ]


Description:


A web page must have an HTTP header output before any other response. Note that while cookies may be set after out-header, they still must be set before outputting the data. If your application uses out-header multiple times, all but the very first one are ignored.

If out-header is not called prior to the actual output, either the header or the output itself (or both) may not be output, and you might get an error. Be sure to always first use out-header prior to any output for a request.

Use out-header for dynamically generated web pages. If you wish to output a file (such as an image or a PDF document), do not use this statement; rather use send-file instead.

The HTTP header is sent back to a client who initiated a request. You can specify any custom headers with "use" clause.

Default header


If "default" clause is in place, a default header is constructed, which uses a status of 200/OK and content type of

text/html;charset=utf-8

and cache control of

Cache-Control:max-age=0, no-cache; Pragma: no-cache

and also sends any cookies produced by set-cookie and delete-cookie. The default header is typical for dynamically generated web pages, and most of the time you would use the default header.

Headers


The following are subclauses that allow setting any custom header:
You can use silent-header before output-header in order to suppress its output.

Examples:


To output the default HTTP header for a dynamically generated page (a typical usage):

out-header default

To set a custom header for a web page that changes cache control and adds two new headers:

out-header use content-type "text/html" cache-control "max-age:3600" custom "some_HTTP_option"="value_for_some_HTTP_option", "some_HTTP_option_1"="value_for_some_HTTP_option_1"


See also:


Web ( call-web   out-header   send-file   silent-header  )  SEE ALL (documentation)



Copyright (c) 2022 DaSoftver LLC. Vely is a trademark of Dasoftver LLC. The software and information herein are provided "AS IS" and without any warranties or guarantees of any kind. Vely elephant logo (c) 2022 DaSoftver LLC. This web page is licensed under CC-BY-SA-4.0.