简体   繁体   中英

Webhook callback getting unexpected response 301 from Azure Function

I've created an Azure Function and hosted it in Azure. It accepts "post" and "get" requests and I can run this locally and get some log output when I either GET or POST to it.

When I host this in Azure, I can get the output the same if I do a GET or POST, which is what I expect (via postman).

I'm using a third party tool for a callback to my Azure Function URL. When this callback gets sent, I don't get any output in the Azure CLI for logs. It is using the exact same address as I was using to get my output in the portal.

The third party tool is saying its getting an HTTP 301 response.

Why would the callback be getting an HTTP 301 when I can post/get to the same address from Postman and get a 200 back?

Function code:

[FunctionName("AddressNotification")]
        public static async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation($"Address Callback function hit from req: {req.Host.ToString()}");

            var content = await new StreamReader(req.Body).ReadToEndAsync();
            log.LogInformation($"Request body: {content}");

            return new OkResult();
        }

Third party tool saying I'm getting a 301:

在此处输入图像描述

I would assume you have https only enabled in your function

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM