Azure functions proxies setting redirects to backendUri Url

988 Views Asked by At

I have azure function app, where I want to use proxy to show static page to the users(which is hosted on another domain) after accessing the function app link like example below https://myfunctionapp1.azurewebsites.net/

{
    "$schema": "http://json.schemastore.org/proxies",
    "proxies": {
        "default": {
            "matchCondition": {
                "methods": [
                    "GET"
                ],
                "route": "/"
            },
            "backendUri": "https://my-site.azurewebsites.net/default.htm"

        }
    }
}

The above configuration I have done a year ago showing up the static page on same url, but now when I access the link https://myfunctionapp1.azurewebsites.net/ it is redirecting to https://my-site.azurewebsites.net/default.htm

Is there any new changes to azure function proxy documentation? If so please refer the link here Thanks & Regards

1

There are 1 best solutions below

0
michn On

I encountered a similar issue where the function proxy redirects the browser to the backend URI instead of showing the results from the backend URI on the proxy URL.

It turns out that if the backend URI replies with a 301 or 302 redirect the proxy will return this redirect to the user's browser and therefore the browser will perform a redirect instead of just showing the contents of the backend URI.

In my case this 301 redirect was caused by the backend URI being https://[domain].com which performed a redirect to https://www.[domain].com. Changing my backend URI to be https://www.[domain].com fixed the issue and it is now working as intended.