Redirection for API linksRSS

2 replies

Last post Mar 18, 2020 08:06 AM by Jalpa Panchal

  • Redirection for API links

    Mar 17, 2020 06:55 AM|TwekanFreak|LINK

    Hey everyone. I have an Angular application that is required to make API requests on 

    https://mydomain.com:8080/mayapp

    So my problem is that I need to redirect these incoming requests to this URL but the API does not have SSL for https requests. I want to use the "mydomain.com" bound to SSL certificate from IIS to redirect my requests over https. Is that possible or am I way off here? 

    Thanks for your time reading this.

  • Re: Redirection for API links

    Mar 17, 2020 06:45 PM|lextm|LINK

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing

    Lex Li
    https://lextudio.com
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Redirection for API links

    Mar 18, 2020 08:06 AM|Jalpa Panchal|LINK

    Hi,

    You could use the IIS arr reverse proxy rule to implement your requirement:

    For that, you need to install the iis URL rewrite module and the Application Request Routing from the below link.

    https://www.iis.net/downloads/microsoft/application-request-routing

    https://www.iis.net/downloads/microsoft/url-rewrite

     <rewrite>
                <rules>
                                              
                    <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                        <match url="(.*)" />
                        <action type="Rewrite" url="http://www.sample1.com/{R:1}" />
                    </rule>
                </rules>
                <outboundRules>
                    <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                        <match filterByTags="A, Form, Img" pattern="^http(s)?://www.sample1.com/(.*)" />
                        <action type="Rewrite" value="http{R:1}://www.sample2.com/{R:2}" />
                    </rule>
                    <preConditions>
                        <preCondition name="ResponseIsHtml1">
                            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                        </preCondition>
                    </preConditions>
                </outboundRules>
            </rewrite>

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.