DataPower

 View Only
  • 1.  Loading websites through DataPower

    Posted Wed December 07, 2022 09:54 AM
    we are trying to load a website(which is a HTTPS website) we do not want any redirection.

    we are able to load the website  but it is redirecting to original site, we want all the sites to be loaded with DataPower url only.

    kindly help with this scenario.

    ------------------------------
    Manasa G
    ------------------------------


  • 2.  RE: Loading websites through DataPower

    IBM Champion
    Posted Wed December 07, 2022 10:11 AM
    The way to handle this, generally speaking, is to inspect the back end response for the Location header, and then strip the web host off replacing it with datapower host.

    That is, you find the Location header in the resonse to be:    https://webhost/..., you change it to be https://dphost/...

    Make sure, too, you set the service to not follow redirects.


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



  • 3.  RE: Loading websites through DataPower

    Posted Thu December 08, 2022 06:24 AM
    Hi Joseph,

    we tried different websites and still unable to find the location header. Also we did disable follow redirects in DataPower and still it is redirecting to the original websites and we are getting a 500 Internal Error.

    here we are facing issue is, it showing the original website hostname instead of DataPower hostname.

    ------------------------------
    Manasa G
    ------------------------------



  • 4.  RE: Loading websites through DataPower

    IBM Champion
    Posted Thu December 08, 2022 02:30 PM
    Ok, so, the setting for DataPower not to follow redirects means DataPower won't internally follow the redirect.  When that is off, DataPower is passing the response back to the client, which follows the redirect. 

    With that said, if you have looked for the Location header in the response *and* it is not present, then there may be some JavaScript loaded through the web page doing the "redirect".    You may need to check that.  


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



  • 5.  RE: Loading websites through DataPower

    Posted Thu December 15, 2022 01:00 AM
    Hi joseph,

    we still didn't get your point about redirect Option in DataPower, it might be a redirect issue with the website.

    is it better approach to load a website through MPGW other than WAF. And how to handle redirect pages that should be under DataPower hostname not with their original hostnames.

    ------------------------------
    Manasa G
    ------------------------------



  • 6.  RE: Loading websites through DataPower

    IBM Champion
    Posted Thu December 15, 2022 06:59 PM
    Are you using a WAF or MPGW?  Handling these is slightly different, but both support turning off automatic redirects.

    In either case, on the response rule, you'll need to create a matching rule to match the location header.  In this case, the matching rule matches "HTTP", the header name is "Location", and the header value should be just "*".

    Then you have to build out the processing rule for it.

    It sounds to me the location header is absolute, so, you'll want to strip the host off of it to make it relative.  That will be part of the response action transform.  Now it will depend upon if you are using GatewayScript or XSLT, but essentially, the result will be the same.  You'll need to remove the protocol and host and then reset the Location header to the relative path.

    So, let's say the Location header comes back:   https://someotherhostname/uri...
    You'll want to take off the "https://someotherhostname" and set the location header to just:   /uri....

    MPGW, in the long run, might be a better choice as things become more sophisticated, though the WAF has some nice features with the Name/Value and Cookie profiles.

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



  • 7.  RE: Loading websites through DataPower

    Posted Mon December 26, 2022 06:29 AM
    Hi Joseph,

    We need to expose all the services(APIs and websites based on context path) through single MPGW with port 443.

    now we are able route to  APIs based on the context path but not websites.

    when we are trying to load the websites separate MPGW with static backend request/response types passthrough it is working fine.
    the same URL we kept in the routing xml file and calling it from 443 port we are unable to load the site properly here request/response type is non-xml because we need to call multiple APIs through the same service.

    how to resolve this issue, please share your thoughts.

    ------------------------------
    Manasa G
    ------------------------------



  • 8.  RE: Loading websites through DataPower

    Posted Thu December 29, 2022 07:11 AM
    Hi Joseph,
    we have loaded website through WAF and its working absolutely fine.
    but we need to implement error handling like displaying custom error message whenever an error occured so when XSLT is placed in error maps it is not handling the errors it is showing the default error only as given below when i gave the additional context path to the request URL.

    please guide us in this.

    Thanks in Advance !!!


    ------------------------------
    Vyasavardhan Ramagiri
    ------------------------------



  • 9.  RE: Loading websites through DataPower

    IBM Champion
    Posted Thu December 29, 2022 11:22 AM
    So, I'm a little confused.  Previous messages suggest you are developing your own API gateway via a MPGW, which is fine.   But, this last one indicates you are using a WAF for the web sites.

    Error handling in the WAF requires an error policy, which you create from the main tab of the WAF configuration screen.

    Create a new policy by selecting the "+" next to the "Default Error Policy".  Give it a meaningful name, and then select "Error Rule" as the mode.

    Select the "+" next to the "Error Rule" to create a new rule.  Give this rule a name, and then select the "+" in the Rule Action table.  Here you'll define the action to take, which can be one of many for the rule.  On the other hand, you can also write the necessary XSLT or GWScript to handle every condition.  It depends upon whether you want to do it more by configuration or code, but honestly, at the end of the day, it is your preference.   I like doing it by configuration because it makes whatever code I do write straightforward and to the point of the error being handled.  

    For now, I know nothing more about what you are trying to accomplish, so it is difficult to guide you farther.



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