Azure self hosted API gateway with docker not working if hosted port other than 8080

Rasmikant Bal 66 Reputation points
2022-12-14T07:19:19.4+00:00

Azure self hosted API gateway with docker not working if hosted port other than 8080

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 on port 80. 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:80 --name SelfGateway --env-file env.conf mcr.microsoft.com/azure-api-management/gateway:v2 => Not Working

If i am hosting my application on port 8080 in docker container, After executing following command i can able to access application using self hosted gateway.

docker run -d -p 80:8080 --name SelfGateway --env-file env.conf mcr.microsoft.com/azure-api-management/gateway:v2 => Working fine

Is there any restriction we must use port 8080 to host application in docker container for http protocol ?

  1. My On Premise APIs are having disaster recovery system (two datacenter 1- primary & 1 - failover). How to configure APIM for On Premise system with self hosted gateway. Suppose the primary Host IP address is 10.133.86.84 & secondary Host IP address is 10.133.86.85 with Load Balancer IP Address is 10.133.86.86. which IP will be consider while configuring with APIM with Self Hosted Gateway ? Do we need to configure APIM with Load balancer IP address (IP Address or Hostname with endpoint need to be mentioned Web Service URL for API ) ?

@JananiRamesh-MSFT - This questions are extension of my earlier questions.

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

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 29,261 Reputation points
    2022-12-15T03:43:51.203+00:00

    Hi @Rasmikant Bal Thanks for reaching out.

    1. Is there any restriction we must use port 8080 to host application in docker container for http protocol?

    Yes, the container will be expecting HTTP call at port 8080, and if the host receives call in 443 it should be forwarded to the port 8081 of a container because that's what it's expecting. Again, you can change the ports on the left-hand side depending on the ports that are available on the host that you're running the container on, but you cannot change the ports on the right hand side. The image was built to listen on those ports.

    270660-image.png

    2) My On Premise APIs are having disaster recovery system (two datacenter 1- primary & 1 - failover). How to configure APIM for On Premise system with self hosted gateway. Suppose the primary Host IP address is 10.133.86.84 & secondary Host IP address is 10.133.86.85 with Load Balancer IP Address is 10.133.86.86. which IP will be consider while configuring with APIM with Self Hosted Gateway ? Do we need to configure APIM with Load balancer IP address (IP Address or Hostname with endpoint need to be mentioned Web Service URL for API ) ?

    In this case you must use the Load balancer ip as shown below

    270775-image.png

    Do let me know if you have any queries.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


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.