Integrate Azure Spring Apps with Azure Load Balance Solutions
Note
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.
This article applies to: ✔️ Java ✔️ C#
This article applies to: ✔️ Basic/Standard ✔️ Enterprise
Azure Spring Apps supports Spring applications on Azure. Increasing business can require multiple data centers with management of multiple instances of Azure Spring Apps.
Azure already provides different load-balance solutions. There are three common options to integrate Azure Spring Apps with Azure load-balance solutions:
- Integrate Azure Spring Apps with Azure Traffic Manager
- Integrate Azure Spring Apps with Azure App Gateway
- Integrate Azure Spring Apps with Azure Front Door
In the examples below, we will load balance requests for a custom domain of www.contoso.com
towards two deployments of Azure Spring Apps in two different regions: eastus.azuremicroservices.io
and westus.azuremicroservices.io
.
We recommend that the domain name, as seen by the browser, is the same as the host name which the load balancer uses to direct traffic to the Azure Spring Apps back end. This recommendation provides the best experience when using a load balancer to expose applications hosted in Azure Spring Apps. If the domain exposed by the load balancer is different from the domain accepted by Azure Spring Apps, cookies and generated redirect URLs (for example) can be broken. For more information, see Host name preservation.
Prerequisites
- A custom domain to be used to access the application: Tutorial: Map an existing custom domain to Azure Spring Apps
- Azure Spring Apps: How to create an Azure Spring Apps service
- Azure Traffic Manager: How to create a traffic manager
- Azure App Gateway: How to create an application gateway
- Azure Front Door: How to create a front door
Integrate Azure Spring Apps with Azure Traffic Manager
To integrate Azure Spring Apps with Traffic Manager, add its public endpoints as traffic manager’s endpoints and then configure custom domain for both traffic manager and Azure Spring Apps.
Add Endpoint in Traffic Manager
Add endpoints in traffic manager:
Specify Type to be External endpoint.
Input fully qualified domain name (FQDN) of each Azure Spring Apps public endpoint.
Select OK.
Configure Custom Domain
To finish the configuration:
- Sign in to the website of your domain provider, and create a CNAME record mapping from your custom domain to traffic manager’s Azure default domain name.
Integrate Azure Spring Apps with Azure App Gateway
To integrate with Azure Spring Apps service, complete the following configurations:
Configure Backend Pool
Add Custom Probe
Select Health Probes then Add to open custom Probe dialog.
The key point is to select No for Pick host name from backend HTTP settings option and explicitly specify the host name. For more information, see Application Gateway configuration for host name preservation.
Configure Backend Setting
Select Backend settings then Add to add a backend setting.
Override with new host name: select No.
Use custom probe: select Yes and pick the custom probe created above.
Integrate Azure Spring Apps with Azure Front Door
To integrate with Azure Spring Apps service and configure an origin group, use the following steps:
Add origin group.
Specify the backend endpoints by adding origins for the different Azure Spring Apps instances.
Specify origin type as Azure Spring Apps.
Select your Azure Spring Apps instance for the host name.
Keep the origin host header empty, so that the incoming host header will be used towards the backend. For more information, see Azure Front Door configuration for host name preservation.