azure self hosted api gateway with docker not working

Rasmikant Bal 66 Reputation points
2022-12-08T16:46:02.48+00:00

One of my requirement is hosting on premise Gateway into Azure API Management. I did following steps.

  1. I created Azure API Management Instance & Added on premise API using OpenApi Specification.
  2. created Azure Self Hosted Gateway (name - SelfGateway) into my APIM instance.
  3. The local docker instance is also working fine for me. its giving results using Postman Tool.
  4. I successfully ran following command & post execute below command show self hosted gateway showing => 1 instance(s), last heartbeat at 10:09:45 PM.

docker run -d -p 80:8080 -p 443:8081 --name SelfGateway --env-file env.conf mcr.microsoft.com/azure-api-management/gateway:v2

  1. When i am trying to access API using Postman from Azure APIM its throwing following error under docker Logs

[Info] 2022-12-9T11:59:30.017, isRequestSuccess: False, totalTime: 3, category: GatewayLogs, callerIpAddress: 172.17.0.1, timeGenerated: 12/09/2022 11:59:30, region: Pune, correlationId: de1661e8-f882-4fe5-9922-4a979ffea595, method: GET, url: http://localhost/WeatherForecast, responseCode: 500, responseSize: 191, cache: none, backendTime: 2, apiId: webapicore, operationId: GetWeatherForecast, clientProtocol: HTTP/1.1, apiRevision: 1, backendMethod: GET, backendUrl: http://localhost/WeatherForecast, lastError: {
"elapsed": 2,
"source": "request-forwarder",
"path": "forward-request\forward-request",
"reason": "BackendConnectionFailure",
"message": "LogError connecting to 127.0.0.1:80",
"section": "backend",
"transportErrorCode": 111
}, errors: [
{
"elapsed": 2,
"source": "request-forwarder",
"path": "forward-request\forward-request",
"reason": "BackendConnectionFailure",
"message": "LogError connecting to 127.0.0.1:80",
"section": "backend",
"transportErrorCode": 111
}
], correlationId: de1661e8-f882-4fe5-9922-4a979ffea595
[Info] 2022-12-9T11:59:53.359 [QuotaCounterSyncSkipped], source: QuotaByKeyCounterService
[Info] 2022-12-9T11:59:53.359 [QuotaCounterApplyGlobalStateSkipped], message: No quota-counters changes retrieved from global state, source: QuotaByKeyCounterService
[Info] 2022-12-9T12:00:09.078 [DnsResolutionStarted], message: localhost, source: RoundRobinNameResolver
[Info] 2022-12-9T12:00:09.080 [DnsResolutionCompleted], message: localhost: [127.0.0.1], source: RoundRobinNameResolver

I am blocked unable to proceed further, please help @JananiRamesh-MSFT @MayankBargali-MSFT

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,447 questions
0 comments No comments
{count} votes

Accepted answer
  1. JananiRamesh-MSFT 29,261 Reputation points
    2022-12-12T17:19:23.57+00:00

    Hi @Rasmikant Bal Thanks for reaching out. could you please verify your Backend url, I see from the given container logs API call that you're making is trying to call itself
    url: http://localhost/WeatherForecast
    backendUrl: http://localhost/WeatherForecast

    please refer the below sample log backendUrl must be your actual backend api.
    269752-image.png

    Do let me know if you have any queries.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.