Best way to redirect a URL to another using Azure private DNS

Deepankar Pal 20 Reputation points

I have a https web application running on custom port of a Virtual Machine. I can access the web application with https://myapp:1234. How can i redirect it in Azure Private DNS so that i only need to browse using https://myapp and it is redirected to the aforesaid link. I understand we have other capabilities like Frontdoor and applicatino gateway but is the redirection possible using Azure private DNS ?

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
506 questions
{count} votes

Accepted answer
  1. GitaraniSharma-MSFT 39,431 Reputation points Microsoft Employee

    Hello @Deepankar Pal ,

    Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

    I understand that you would like to know the best way to redirect a URL to another using Azure private DNS.

    Azure DNS doesn't support URL redirects. URL redirect services aren't a DNS service. They work at the HTTP level rather than the DNS level. Some DNS providers bundle a URL redirect service as part of their overall offering. This service isn't currently supported by Azure DNS (including Private DNS).

    The URL redirect feature is tracked in the Azure DNS backlog. Use the feedback site to register your support for this feature.


    So, you would need to use another service such as a load balancer, application gateway or front door in front of your VM and use a custom domain via CNAME record to access your application.


    Kindly let us know if the above helps or you need further assistance on this issue.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Deepanshu katara 1,110 Reputation points

    Hi , Hope doing good!

    To answer your query , please check below

    Azure Private DNS is primarily designed for DNS resolution within virtual networks and does not have the capability to perform HTTP(S) redirection. To achieve HTTP(S) redirection from https://myapp to https://myapp:1234, you would typically need to use a different Azure service like Azure Application Gateway or Azure Front Door.

    Here's a brief overview of how you can achieve this redirection using Azure Application Gateway:

    Create an Azure Application Gateway: Deploy an Azure Application Gateway in your virtual network.

    Backend Pool Configuration: Configure the backend pool of the Application Gateway to point to the virtual machine and the custom port (e.g., myapp:1234).

    HTTP(S) Listener and Rule: Create an HTTP(S) listener and a URL path-based rule within the Application Gateway. The listener should listen on https://myapp, and the rule should perform the redirection to https://myapp:1234.

    SSL Certificate: Ensure that you have an SSL certificate configured for https://myapp. If you don't have a wildcard certificate, you'll need a certificate that matches the specific hostname.

    Frontend IP Configuration: Set up frontend IP configurations and assign the SSL certificate to the listener.

    Health Probes: Configure health probes to ensure the backend VM and port (myapp:1234) are healthy.

    Test and Verify: Test the configuration by accessing https://myapp in your browser. You should be redirected to https://myapp:1234.

    Azure Application Gateway is a powerful service that can handle various HTTP(S) traffic management scenarios, including SSL termination, URL-based routing, and redirection.

    While Azure Private DNS doesn't perform redirection, it is still essential for DNS resolution within your virtual network and can be used to resolve the hostname (myapp) to the private IP address of your virtual machine.

    In summary, to achieve HTTPS redirection in Azure from https://myapp to https://myapp:1234, you should use Azure Application Gateway or a similar service. Azure Private DNS should be used for DNS resolution and won't handle HTTP(S) redirection.

    0 comments No comments