Forum OpenACS Q&A: Updating header before calling ns_returnredirect
I need to add a header before calling ns_returnredirect but somehow not succeeding to do it. As suggested in one of the aolserver articles, I tried the following but no success:
ns_set put [ns_conn outputheaders] myHeader $myHeaderValue
The following script named "redirect.tcl"
ns_set put [ns_conn outputheaders] myHeader foo ns_returnredirect /returns the following to the browser
Connection:keep-alive Content-Length:307 Content-Type:text/html; charset=utf-8 Date:Fri, 21 Apr 2017 17:07:45 GMT Location:/ myHeader:foo Server:NaviServer/4.99.16d4... so, the extra header is includes, everything works as expected. This is with NaviServer 4.99.16d4.
What exact server are you using?
I am using AOLserver/3.5.11 ..... thought the code you mentioned should function the same way; but apparently it does not.
AOLserver/3.5.11 is not *that* old that it should have a different way of writing headers.
One thing you could try is to search your existing codebase for examples of how headers are set. Presumably it's working, so it is just a matter of finding it. For example, search for where cookies are created. If you are not using OpenACS, the headers might be written with just a raw ns_write.
Let us know if you need more help