Layer 7 API Management

Expand all | Collapse all

How to do Redirection to a URL

Jump to Best Answer
  • 1.  How to do Redirection to a URL

    Posted 03-31-2017 05:25 AM

    Hi,

     

     I am trying to #redirect the request to gateway to an external website (https://www.icicibank.com) . However #redirection does not seem to be working. Below is the route assertion:

     

     

    I tried with checking Follow-Redirect as well unsuccessfully. We need to redirect all the requests coming to policy to https://www.icicibank.com.

     

    Please help.

     

    Thanks,

    Sid.



  • 2.  Re: How to do Redirection to a URL

    Posted 03-31-2017 07:05 AM

    change https to http



  • 3.  Re: How to do Redirection to a URL

    Posted 03-31-2017 08:24 AM

    That I tried and it works because www.icicibank.com has internal redirection from http to https. However there are other URLs, where we need to redirect (like 

    https://m2wnet.icicibank.co.in/STAR_M2W/oRegPg_reg ). Here with this site, there is no internal redirection from http to https and hence GW redirection does not working here. Please let me know if we can redirect to 

    https://m2wnet.icicibank.co.in/STAR_M2W/oRegPg_reg through Gateway policy.

     

    Thanks,

    Sid



  • 4.  Re: How to do Redirection to a URL

    Posted 03-31-2017 08:20 AM

    Hi Sid,

     

    I would check the logs for any errors. Typically you will see this type of error if you did not import the target cert into the gateway.

     

    Problem routing to https://www.icicibank.com. Error msg: Unable to obtain HTTP response from  https://www.icicibank.com found but not trusted for SSL

     

    Alternatively, you could use an HTTP 302 redirect instead of an HTTP route assertion.

     

    Regards,

    Joe



  • 5.  Re: How to do Redirection to a URL

    Posted 04-03-2017 02:40 AM

    Hi Joe,

     

     Tried with the redirection approach. That too is not working. We want to redirect to ICICI Bank Money2World: Register Now  

     

    However, neither route nor redirection approach seems to be working. 

     

    Thanks,

    Sid.



  • 6.  Re: How to do Redirection to a URL

    Posted 04-02-2017 07:40 PM

    Hello SIDDHARTHJAISWAL ,

    If only https has problem, I was wondering if you'd imported the certificate of icicibank?

    Gateway won't trust any sites by default, need to import the certificate to trust the site.

     

    Regards,

    Mark



  • 7.  Re: How to do Redirection to a URL
    Best Answer

    Posted 04-03-2017 02:44 PM

    Sid,

    if the only thing you want to do in policy is to redirect to the register endpoint, you only need to do the following:

    1. Create the endpoint on the gateway that should redirect the user (e.g.: /proxy/icicibank)
    2. Include a "Return Template Response to Requestor"
      1. HTTP status 302, content-type: text/plain
      2. Do NOT check "Send Response Immediately"
    3. Include "Manage Transport Properties/Headers"
      1. Type: HTTP Header, Operation: Add or Replace, Name: Location, Value: your target URL

    Your overall policy should have two assertions now. (Not good enough for production but to get you started).

    I tried this myself and it works perfectly fine. Its almost the same response as further up, just make sure the header gets added to the "Response".

    Regards,

    Sascha



  • 8.  Re: How to do Redirection to a URL

    Posted 03-07-2019 05:37 PM

    Sascha,

     

    We're actively doing exactly this in a few policies, however, I'm currently running into an issue where I need to redirect a POST request to an external URL with a GET request (erasing the data from the original POST).  Is this possible to do with a 302 redirect like this?

     

    Thanks,

    Dave



  • 9.  Re: How to do Redirection to a URL

    Posted 03-08-2019 08:20 AM

    Hi David,

     

    An HTTP 303 can be used as a redirect for this. In the HTTP standard, only the status code 303 enforces rewriting the HTTP POST request to an HTTP GET request

     

    303 See Other - HTTP | MDN 

     

    Hope this helps.

     

    Regards,

    Joe



  • 10.  Re: How to do Redirection to a URL

    Posted 03-12-2019 10:34 AM

    Awesome, I'll give that a try, thank you Joe!