Topic
  • 15 replies
  • Latest Post - ‏2014-07-17T20:09:08Z by kenhygh
nepomuk
nepomuk
151 Posts

Pinned topic Removing Content-Type from http header

‏2013-07-15T15:17:19Z |

I am processing REST GET and DELETE calls and need to remove Content-Type from the http header. But every time I delete it Datapower puts it back at the end of the rule.

Anyone know how I can delete it from a request?

  • Miel
    Miel
    50 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-15T17:58:51Z  

    Hi,

                         Delete the HTTP content type header after the result action of your rule or remove the result action from the rule.

    Result action will automatically add the default content type header.

  • JTQK_Sunny_Goel
    JTQK_Sunny_Goel
    10 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-23T21:09:12Z  
    • Miel
    • ‏2013-07-15T17:58:51Z

    Hi,

                         Delete the HTTP content type header after the result action of your rule or remove the result action from the rule.

    Result action will automatically add the default content type header.

    Hi Miel,

    I tried following methods but nothing worked for "Content-Type" http header. Please help us in resolving this problem.

    1.) Used following code in xslt and removed result action from request rule.

    2.) Used following code in xslt after result action.

    <dp:remove-http-request-header name="Content-Type"/>

    Thanks

     

     


     

     

  • Miel
    Miel
    50 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-24T04:35:26Z  

    Hi Miel,

    I tried following methods but nothing worked for "Content-Type" http header. Please help us in resolving this problem.

    1.) Used following code in xslt and removed result action from request rule.

    2.) Used following code in xslt after result action.

    <dp:remove-http-request-header name="Content-Type"/>

    Thanks

     

     


     

     

    Hi,

       Try with suppression headers. go to header tab of your service and configure the suppression header (back or front ), it will remove the mentioned headers before forwarding the request to the backend server.

     

  • JTQK_Sunny_Goel
    JTQK_Sunny_Goel
    10 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-24T19:02:38Z  
    • Miel
    • ‏2013-07-24T04:35:26Z

    Hi,

       Try with suppression headers. go to header tab of your service and configure the suppression header (back or front ), it will remove the mentioned headers before forwarding the request to the backend server.

     

    Hi Miel,

    I tried suppressing following HTTP headers using "Headers/Params" tab of web service proxy service. But i was able to suppress only 1 header and that is "Content-Length". I am assuming we cann't suppress other headers. Service adds these headers before forwarding request to backend.

     

    HTTP headers

    X-Client-IP,Content-Type and Content-Length

    Thank you

     

     

     

  • HermannSW
    HermannSW
    6019 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-24T20:13:50Z  

    Hi Miel,

    I tried suppressing following HTTP headers using "Headers/Params" tab of web service proxy service. But i was able to suppress only 1 header and that is "Content-Length". I am assuming we cann't suppress other headers. Service adds these headers before forwarding request to backend.

     

    HTTP headers

    X-Client-IP,Content-Type and Content-Length

    Thank you

     

     

     

    The spec defines HTTP header entries here:
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

    I did add header suppresions for the following fields on MPGW's Headers tab.
    The MPGW was a XML request, with Process Empty Messages On and pass-thru response service.
    Backend was a passthru loopback XML FW on same box.

    That way sending GET request by "curl ... -v" returns all the headers send to "backend" in curl response.

    These "back" suppressions did not have an effect:

    The Via general-header field MUST be used by gateways and proxies
    The Transfer-Encoding general-header field
    The Content-Type entity-header fiel
    The Connection general-header field
    The Cache-Control general-header

    And this does not have an effect (because of the MUST from spec)

    The Host request-header field ... A client MUST include a Host header field in all HTTP/1.1 request messages .

    This one got removed successfully:

    The User-Agent request-header field

     

    So it seems that you cannot suppress "general-header", "entity-header" and some special "request-header" fields.

    But you can suppress "request-header" fields normally.

     

    Trying to get someone to comment on this who knows more than me on this ...

     

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>



     

    Updated on 2013-07-24T20:16:39Z at 2013-07-24T20:16:39Z by HermannSW
  • Miel
    Miel
    50 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-25T05:29:45Z  
    • HermannSW
    • ‏2013-07-24T20:13:50Z

    The spec defines HTTP header entries here:
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

    I did add header suppresions for the following fields on MPGW's Headers tab.
    The MPGW was a XML request, with Process Empty Messages On and pass-thru response service.
    Backend was a passthru loopback XML FW on same box.

    That way sending GET request by "curl ... -v" returns all the headers send to "backend" in curl response.

    These "back" suppressions did not have an effect:

    The Via general-header field MUST be used by gateways and proxies
    The Transfer-Encoding general-header field
    The Content-Type entity-header fiel
    The Connection general-header field
    The Cache-Control general-header

    And this does not have an effect (because of the MUST from spec)

    The Host request-header field ... A client MUST include a Host header field in all HTTP/1.1 request messages .

    This one got removed successfully:

    The User-Agent request-header field

     

    So it seems that you cannot suppress "general-header", "entity-header" and some special "request-header" fields.

    But you can suppress "request-header" fields normally.

     

    Trying to get someone to comment on this who knows more than me on this ...

     

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>



     

    Hi Hermann,

                 I agreed your statement, looks like we can't suppress "general-header","entity-header" using the suppression header option.

  • Miel
    Miel
    50 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-26T05:50:26Z  

    Hi Miel,

    I tried following methods but nothing worked for "Content-Type" http header. Please help us in resolving this problem.

    1.) Used following code in xslt and removed result action from request rule.

    2.) Used following code in xslt after result action.

    <dp:remove-http-request-header name="Content-Type"/>

    Thanks

     

     


     

     

    Hi,

          After removing the Content-Type header , freeze the headers using dp element called <dp:freeze-headers/>.It works charm

                        <dp:remove-http-request-header name="Content-Type"/>

                        <dp:freeze-headers/>

     

    Regards,

    Miel.

  • srinivasdp
    srinivasdp
    1 Post

    Re: Removing Content-Type from http header

    ‏2013-07-26T11:15:01Z  
    • Miel
    • ‏2013-07-26T05:50:26Z

    Hi,

          After removing the Content-Type header , freeze the headers using dp element called <dp:freeze-headers/>.It works charm

                        <dp:remove-http-request-header name="Content-Type"/>

                        <dp:freeze-headers/>

     

    Regards,

    Miel.

    Hi

    This is srinivas, i am a new datapower developer,please any one  post some importent dp functions and explain.

     

    Regards

    srinivas

     

  • David07
    David07
    77 Posts

    Re: Removing Content-Type from http header

    ‏2013-07-26T11:59:14Z  

    Hi

    This is srinivas, i am a new datapower developer,please any one  post some importent dp functions and explain.

     

    Regards

    srinivas

     

    Hi,

    Please go through the below mentioned link, every dp function is explained clearly. You will get an idea about it.

    http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/index.jsp?topic=%2Fxa35%2Fextensionfunctions.htm

     

    Regards,

    David.