Implementation of routing page's additional "Request Headers"

How is the routing page's additional request headers field implemented in Website? It appears that the additional headers you specify will be included in any request to modules issued by Website server side but won't be included in any ajax request to modules. Could this be done?

Best Answer

  • Adam.Lemker
    Answer ✓
    James is right about the half baked part. The headers are only added to outgoing server-side calls. Adding them to AJAX calls would probably require including the array of headers in the JavaScript on every page or storing them in a cookie. On top of this, they would need to be hooked into the Cobalt.Net.WebRequest code. If I remember correctly, we left out the AJAX side of it because the people requesting this only needed it on server-side calls and we didn't have the time for the addition to the JavaScript.

Answers

  • This sounds like a Website feature request (?).
  • Check with @AdamLemker, looks like he implemented it originally. My guess is that it is only half-baked (no offense to Adam), such that Website will pass those headers on server-side calls but not on AJAX calls. Additionally, the HttpClient infrastructure libraries might need to be updated to support passing these headers along for server-side calls beyond Website (e.g. Document calling DataOrchestrator).
  • Possibly - wasn't sure what was already implemented when that was added to the routing page. Plus, wanted an understanding of how it does work today.
  • Thanks for the good info Adam - sounds like if the desire exists for those optional headers to be passed along on ajax calls we'd need to pursue that in Website/Static Content
  • Schu: Should be pretty easy to implement the AJAX header passing. My bigger concern would be if the HttpClient libs are going to pass them along... my guess is that it would not, since it can't really anticipate what custom headers you'll be setting/overriding. That would probably have to be done manually...?
  • I heard a rumor (unconfirmed) that the infrastructure HttpClients will honor headers with certain prefixes (e.g. x-cobalt-product...) so it _may_ work.