Praneetha
Praneetha

Reputation: 311

How to add a subdomain in cloudflare for my azure container which requires a port number to access it

I have a metabase docker image running on my Azure container. It can be accessed through azure's fqdn:port_number (port is 3000) or ip:port_number. I want to give a nice domain name for this application through cloudflare(. How can I do this? Thanks in Advance!

PS: There were some topics on this in cloudflare community but I couldn't fine any answer relevant for me.

Upvotes: 0

Views: 855

Answers (1)

Nancy Xiong
Nancy Xiong

Reputation: 28224

You could add a CNAME record to point subdomain such as www.example.com to the FQDN value of your Azure container like containerdns.westus.azurecontainer.io.

Example of a CNAME record:

name: www    
record type: CNAME    
value:  FQDN value of your Azure container
TTL: 32600

enter image description here ref: https://www.cloudflare.com/learning/dns/dns-records/dns-cname-record/ https://support.cloudflare.com/hc/en-us/articles/360019093151-

Update

From your comment, you want to access myapp.com which actually points to fqdn:port. In this case, you could create and configure an application gateway to host web sites with custom ports using the Azure portal. If you have multiple sites, you could follow this tutorial.

You could follow the steps below:

  1. Create a public-facing application gateway with a public IP address in the same region as your container instance.
  2. Create a backend pool with target hostname of your container FQDN like containerdns.westus.azurecontainer.io
  3. Create a basic listener and provide name, frontend port 80 and protocol HTTP.
  4. Create a health probe, provide protocol HTTP, check the box Pick host name from backend http settings and the remaining setting is the default.
  5. Add an HTTP-settings with custom port 3000 as your desired and check the box Pick host name from backend address and use custom probe and select custom probe.
  6. Create a basic rule with the backend pool and HTTP setting.
  7. In the end, you could create a CNAME record mapping the subdomain www.myapp.com to the FQDN of your application gateway.

I validate this on my website on Azure VM, hope this could help you.

Upvotes: 1

Related Questions