Juiano Juiano - 6 months ago 42
Java Question

Redirect Azure WebPage Port to VM

I'm building a project that consists in one web site and one Java application. The web site is running as a Web App inside Azure, and my application is in a Virtual Machine in Azure too. This java application is a Web Server that an user could consume it from the internet.

So what i'm am trying to accomplish here is, when an user types

, it opens the web site, and when he types
, he should be redirected to my application in the virtual machine. So he can access my Web Server without using the IP directly.


Per my experience, there are two ways which can satify your needs, and it's not necessary to specify an alone port for a redirect request to VM.

  1. As @DavidMakogon said, you can create a request filter in your Java Application to use the function like response.sendRedirect() to redirect a request for an url mapping pattern, that's based on HTTP 30X.

  2. You can try to create an Azure Application Gateway for your website & VM to direct the request using URL pattern routing, please see the offical article Create an application gateway using URL based routing to know how to get started.