1

I need to store whole HTTP request made to a CloudPage for audit purposes. I'm able to log everything besides headers. I'm unable to read all of them with ampscript or SSJS without knowing their names in advance. Functions I was able to find require me to provide a name, these are:

1 Answer 1

0

I found a reference of httpHeader() function, allowing you to build this snippet iterating through all headers:

var header = Platform.request.httpHeader();
var count = 0;
var i;
for (i in header ) {
write(count + ". " + i + " " + header[i] + "<br>\n");
count++;
} 

My initial tests on CloudPages all ended up in server error, stating: Object expected: httpHeader. I wasn't able to dig further into this today, but I expect this not being included in the limited scope of SSJS functions in SFMC. It is not documented in official SFMC SSJS docs, but you can find it described on page 303 of this manual from Oracle.

I will do some more searching and asking as soon as time allows.

3
  • Unfortunately I believe that is stored in the 'HTTPHeader' object (developer.salesforce.com/docs/…) - which is a controlled object by SFMC and only allows 'GetValue()', 'SetValue()' and 'Remove()'. and in each of these functions, it has to be specified, you cannot leave it ambiguous to gather all. Jun 22, 2020 at 14:22
  • Furthermore, If you stringify the 'HTTPHeader' object, you only receive a list of functions available to it: {"SetValue":"function","GetValue":"function","Remove":"function"}. And using httpHeader() in Platform.Request throws a 'security descriptor' error and is Jint exception in 'Request' Core object. Jun 22, 2020 at 14:22
  • Oh and I think (read: an assumption) that this object is pulled off the .Net HttpHeaders class (docs.microsoft.com/en-us/dotnet/api/…) for reference. But nothing listed there or in any other places related to this object/class work other than those 3 pre-defined functions. Jun 22, 2020 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .