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
------------------------------
Original Message:
Sent: Thu December 15, 2022 01:00 AM
From: Manasa G
Subject: Loading websites through DataPower
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
Original Message:
Sent: Thu December 08, 2022 02:29 PM
From: Joseph Morgan
Subject: Loading websites through DataPower
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
Original Message:
Sent: Thu December 08, 2022 06:23 AM
From: Manasa G
Subject: Loading websites through DataPower
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
Original Message:
Sent: Wed December 07, 2022 10:10 AM
From: Joseph Morgan
Subject: Loading websites through DataPower
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
Original Message:
Sent: Wed December 07, 2022 02:28 AM
From: Manasa G
Subject: Loading websites through DataPower
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
------------------------------