Can I add Events to AJAX request headers?

Can I add CrazyTrain/UX Events to AJAX request headers from the client-side like we do on the server-side? e.g. [pseudo-code] ``` $.ajax("/Document/v1/FullText/i3489314632987329487321984/whatever", { cobaltHost: Cobalt.Vertical.Document, type: "POST", contentType: "application/json", headers: { "x-cobalt-events": JSON.stringify([{...}]) } }); ``` Or do I have to send a direct AJAX call to the Events vertical instead? e.g. [pseudo-code] ``` $.ajax(Cobalt.Configuration.ClientEventURL, { cobaltHost: Cobalt.Vertical.Events, type: "POST", contentType: "application/json", data: JSON.stringify([{...}]) }); ``` Everything I've seen in the Cobalt JS world would suggest the latter. =(

Best Answer

  • as far as I can remember, Apache Interceptor only strips off the x-cobalt-events header on a server's response to a browser - I think it ignores headers coming from the browser.

Answers

  • I've never seen it done by adding headers to the request.
  • Yep... this is correct. Though you CAN have the module you are calling regurgitate the events on the response for you, but that would be up to the module to support that.
  • Darn! Thanks for confirming, though. Just a technicality but isn't it the Apache Interceptor that grabs these headers rather than BigIP?