DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Custom Http Response headers are not getting passed to Application

  • 1.  Custom Http Response headers are not getting passed to Application

    Posted Wed July 10, 2024 04:36 PM

    Hello Evenryone, 

    I have built a MPG that does the below process.

    1)  Accepts the JSON request with http request headers like - correlId,Content-type,xyz and then makes a call to ACE using Call-Processing rule with URL-open.

    2) Depending on ACE response element value, 

         A. it may need to continue to next steps- transform request and call the next back-end

         B. Send the response, using SKIP-backside

    For case B:  i am unable to send the response as the processing rule is in client-server mode and continue to execute the step A and finally giving the response.

    I tried the below option:

      In the Call processing rule: used On-Error Rule with Error mode-Cancel,Input:Auto,Output:Auto,ProcessingRule:Custom-error-rule, Then used session.reject to throw theException.When it reaches the Custom-error-rule, i am Creating the final json response and along with http response headers -  correlId,Content-type,xyz(Same as requst Headers), those custom response headers are showing up in the probe but not at the application ex:postman.

    Tried all the option to manipulate the http response headers using both  XSLT and GatewayScript
    <dp:set-http-request-header name="'correlation-id'" value="'45367373'"/>
        <dp:set-http-response-header name="'correlation-id'" value="'45367373'"/>

    Are there any configuration/properties to be updated at the MPG?

    Postman snippet:



    ------------------------------
    Sandeep Kolisetti
    ------------------------------


  • 2.  RE: Custom Http Response headers are not getting passed to Application

    Posted Wed July 10, 2024 05:03 PM

    Without seeing the processing policy, I can only suggest setting a context variable after the ACE call and then drive the remainder of the rule with conditionals and other call rules, setting as many context variables as needed to control that flow.  I suspect the last conditional will be to determine if you will set the skip-backside and return whatever context should be returned to the client.



    ------------------------------
    Joseph Morgan
    ------------------------------