Adding HTML request headers

How can I add some extra request html headers such as :

request.Header("Strict-Transport-Security")="max-age=31536000"

If I return True from the app.handleURL event I get the header but no content.
If I return false I get the content, but no extra header.

Is there another way of adding this header to all requests?

Lee

Post your code.

I’ve tried various iterations of code but this code gives a blank webpage, but the correct headers.

Function HandleURL(Request As WebRequest) As Boolean If Request.Path <> "" then app.debugmessage("HandleURL "+Request.Path) Request.Status = 404 Return True else request.Header("Strict-Transport-Security")="max-age=31536000" request.Header("Connection")="keep-alive" Request.Status=200 return true End If End Function

This code gives the correct page, but no extra headers.

Function HandleURL(Request As WebRequest) As Boolean request.Header("Strict-Transport-Security")="max-age=31536000" request.Header("Connection")="keep-alive" return false End Function

I’m testing the headers with

curl -s -D- https://webserveraddress/

[code]HTTP/1.1 200 OK
Content-Type: text/html
Date: Mon, 07 Mar 2016 16:33:37 GMT
X-Content-Type-Options: nosniff
Connection: close
X-Frame-Options: SAMEORIGIN
Cache-Control: no-cache
Content-Encoding: gzip
Content-Length: 1287

?
?t??R?FRv???})??+???m???{???O?O?[/code]

Are you calling Request.Print to actually send back a page when you return True?

I’m not, but that is my problem.

I want the original page as designed in the interface (i.e. return false) BUT with the added headers.

Lee

[quote=251618:@Lee Badham]I want the original page as designed in the interface (i.e. return false) BUT with the added headers.
[/quote]

Greg will probably chime in, but as far as I know you simply cannot do that. The graphic interface uses a whole set of headers that are basically off limit.

I’m basically trying to implement OTG-CONFIG-007

Adding a single html header to each request, but leave everything else alone.

Lee

[quote=251780:@Lee Badham]I’m basically trying to implement OTG-CONFIG-007

Adding a single html header to each request, but leave everything else alone.

Lee[/quote]

Try adding it in App.HtmlHeader.

I did, That added to each page in the area, not in the http header.

Lee

[quote=251791:@Lee Badham]I did, That added to each page in the area, not in the http header.

Lee[/quote]

Yes, of course. Sorry.