Topic
  • 2 replies
  • Latest Post - ‏2013-01-04T03:06:19Z by SystemAdmin
SystemAdmin
SystemAdmin
6772 Posts

Pinned topic Web Application Frewall redirect in the error map is not working

‏2012-12-31T01:31:34Z |
Hi,
When there is any error within DataPower I am trying to redirect the user to a custom page on a different server, which after fixing the issue will redirect the user to the DP page with the right info in the query string. I have an error map with an XSLT as below and the WAF has the Follow Redirects as on. When there is any error the XSL is getting called but the user's browser is not being redirected and resulting in an error "The website cannot display the page". But if I specify a Default Error Policy with Mode as Redirect then the user's browser is being redirected to the specified URL.

<dp:set-http-response-header name="'x-dp-response-code'" value="'302 redirected'" />
<dp:set-http-response-header name="'Location'" value="$dpconfig:AccEnableURL" /> where AccEnableURL is http://1.2.3.4:80/accapp/enable.jsp

Please let me know if I am missing anything here.

Thanks
Updated on 2013-01-04T03:06:19Z at 2013-01-04T03:06:19Z by SystemAdmin
  • HermannSW
    HermannSW
    4740 Posts

    Re: Web Application Frewall redirect in the error map is not working

    ‏2012-12-31T17:59:15Z  
    Hi,

    I do not have access to my DataPower boxes currently.
    But "x-dp-response-code" is not a normal HTTP header field,
    The x-dp-response-code special code is a protocol response code that is returned to the DataPower® server. 
    This special code is not a field that is included in the response header. 
    This special code contains the protocol-specific response code.
    

    and therefore "dp:set-http-response-header()" cannot be used for it.

    I just referred to this posting in another thread on how to set the HTTP response code:
    https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/entry/april_1_2011_5_15_pm14

    That will work for "normal" HTTP response codes.
    If your client application will treat the 302 redirect, everything will be fine.

    In case you want DataPower to do the redirected request, that has to be done differently.

     
    Hermann <myXsltBlog/> <myXsltTweets/>
    Updated on 2014-03-25T02:43:59Z at 2014-03-25T02:43:59Z by iron-man
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: Web Application Frewall redirect in the error map is not working

    ‏2013-01-04T03:06:19Z  
    • HermannSW
    • ‏2012-12-31T17:59:15Z
    Hi,

    I do not have access to my DataPower boxes currently.
    But "x-dp-response-code" is not a normal HTTP header field,
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">The x-dp-response-code special code is a protocol response code that is returned to the DataPower® server. This special code is not a field that is included in the response header. This special code contains the protocol-specific response code. </pre>
    and therefore "dp:set-http-response-header()" cannot be used for it.

    I just referred to this posting in another thread on how to set the HTTP response code:
    https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/entry/april_1_2011_5_15_pm14

    That will work for "normal" HTTP response codes.
    If your client application will treat the 302 redirect, everything will be fine.

    In case you want DataPower to do the redirected request, that has to be done differently.

     
    Hermann <myXsltBlog/> <myXsltTweets/>
    <dp:set-variable name="'var://service/error-protocol-response'" value="'302 redirected'" /> is working fine thanks for the suggestion