fix: Configure API proxy with dynamic BACKEND_URL#829
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the web app’s backend API proxy configuration so the frontend connects to the backend container instance endpoint derived from deployment outputs rather than hardcoded/fallback values, and adjusts infra dependency/setting-merge behavior to support that.
Changes:
- Inject
BACKEND_URLinto the web app using ACI IP/FQDN outputs (Bicep + generated ARM), and ensure the web app deployment depends on the ACI deployment. - Adjust app settings merge order so newly provided settings override existing app settings.
- Update the Node server to only enable the
/apiproxy whenBACKEND_URLis present (removing the hardcoded fallback).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/App/server/server.js | Removes hardcoded backend fallback; conditionally enables the API proxy based on BACKEND_URL. |
| infra/modules/web-sites.config.bicep | Changes union/merge order so new app settings override retained current settings. |
| infra/main.bicep | Computes backend URL from containerInstance module outputs (IP/FQDN) and injects into web app settings. |
| infra/main_custom.bicep | Computes backend URL from ACI resource properties and injects into web app settings. |
| infra/main.json | Generated template updates: removes fallback vars, references containerInstance outputs for BACKEND_URL, and adds dependency ordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Avijit-Microsoft
approved these changes
Apr 28, 2026
Contributor
|
🎉 This PR is included in version 2.4.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request updates how the backend API URL for the web application is determined and injected, ensuring that the web app always connects to the correct backend container instance (ACI) endpoint based on deployment outputs instead of hardcoded or fallback values. It also improves deployment dependencies and environment variable handling for both infrastructure and application code.
Key changes:
Backend URL resolution and dependency improvements:
aciBackendUrl) is now dynamically set using the actual output IP or FQDN from the container instance deployment, ensuring the web app always points to the correct backend endpoint and that the web app deployment waits for the container instance to be ready (infra/main.bicep,infra/main_custom.bicep). [1] [2]infra/main.json). [1] [2]infra/main.json).Deployment and dependency ordering:
infra/main.json). [1] [2]Application code improvements:
BACKEND_URLenvironment variable to be set at runtime, removing any hardcoded fallback, and logs an error if it is missing. The proxy middleware is only enabled ifBACKEND_URLis set (src/App/server/server.js). [1] [2] [3]App settings merge logic:
web-sites.config.bicep, the merge order for application settings was adjusted to ensure that current app settings are merged before new properties, which can affect override behavior (infra/modules/web-sites.config.bicep).These changes together ensure that the backend URL is always accurate, deployment dependencies are respected, and the application behaves correctly in all deployment scenarios.
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation