Topic
7 replies Latest Post - ‏2013-04-06T15:24:37Z by HermannSW
Arnab_Ghosh
Arnab_Ghosh
70 Posts
ACCEPTED ANSWER

Pinned topic HTTP Response header

‏2013-04-04T18:01:30Z |
Hi,
I am setting many response headers like this below and i need to check in the probe whether the values are properly getting set or not. But in the probe I am only getting those values which are set as request header. Is there any way to check the same for response header?

<dp:set-http-response-header name="'Session-Id'" value="$response/response/sessionId"/>

Thanks,
Arnab
Updated on 2013-04-06T15:24:37Z at 2013-04-06T15:24:37Z by HermannSW
  • swlinn
    swlinn
    1327 Posts
    ACCEPTED ANSWER

    Re: HTTP Response header

    ‏2013-04-05T14:23:28Z  in response to Arnab_Ghosh
    The response headers only show in the probe in the response rule. Where are you setting these response headers in the processing policy? If you set them in the request rule they should be visible in the response rule, although I don't know what would happen if the backend had the same header in its response. If that is a problem, you could always place your data into context and set the response header in the response rule xslt.

    Regards,
    Steve
    • Arnab_Ghosh
      Arnab_Ghosh
      70 Posts
      ACCEPTED ANSWER

      Re: HTTP Response header

      ‏2013-04-05T16:23:37Z  in response to swlinn
      Hi Steve,
      Its in the error rule where i need to add , update and remove headers. I tried with these 3 below but 1 and 2 are not working. What should i need to do? 'Connection' and 'Content-Type' are already there in the headers but they are neither removed nor updated.

      1. <dp:remove-http-response-header name="'Connection'"/>
      2. <dp:set-response-header name="'Content-Type'" value="'text/xml;charset=ISO-8859-1'"/>
      3. <dp:set-response-header name="'Date'" value="date:date-time()"/>
      • swlinn
        swlinn
        1327 Posts
        ACCEPTED ANSWER

        Re: HTTP Response header

        ‏2013-04-05T21:00:32Z  in response to Arnab_Ghosh
        Hi Arnab,
        Modifying Content-Type has always been tricky in my opinion. By chance are you running your stylesheet after having a transformation output to the OUTPUT context? From my notes, you should try a transformation that does the header manipulation of Content-Type that has NULL input/output contexts, then any transformation that may write to the OUTPUT context. I can't necessarily speak to removing the Connection header, but it may have a similar issue. What does your error rule look like today?

        Regards,
        Steve
        • Arnab_Ghosh
          Arnab_Ghosh
          70 Posts
          ACCEPTED ANSWER

          Re: HTTP Response header

          ‏2013-04-05T21:21:00Z  in response to swlinn
          Steve, in my error rule, I have 3 transform actions and then the result action. I am creating the response in the 2nd transform action, which has input as INPUT and output as ERROR_RESPONSE. I am returning this error response in the output using the result action. In the second response itself i am updating and deleting the headers. Addition of header "Date" worked fine but update and removal dint worked.
          • swlinn
            swlinn
            1327 Posts
            ACCEPTED ANSWER

            Re: HTTP Response header

            ‏2013-04-05T22:44:48Z  in response to Arnab_Ghosh
            Hi Arnab,
            I've reviewed some internal forum threads on Content-Type manipulation, so I'd recommend you try the following to see if this helps.

            1) Move the http header manipulation to a stylesheet of it's own, input context=NULL, output context=NULL
            I also saw references to some trying to also do a dp:freeze-headers extension function
            2) Have your stylesheet that creates your error response follow that transformation action. Have it output to the OUTPUT context.
            3) Don't do your result action as you had the transformation action output to OUTPUT

            If this doesn't work, I'm out of suggestions, perhaps you should then open a PMR.

            Regards,
            Steve
            • Arnab_Ghosh
              Arnab_Ghosh
              70 Posts
              ACCEPTED ANSWER

              Re: HTTP Response header

              ‏2013-04-05T22:59:26Z  in response to swlinn
              Thanks Steve for your response. It is now updating the headers though not deleting the same.
              I have done exactly the same as you told only with one difference and that is my "SetHeader" transform action is following the "CreateResponse" transform action.