संपादित करें

इसके माध्यम से साझा किया गया


Configuration overview

The following different concepts apply to configuring a static web app.

  • Application configuration: Define rules in the staticwebapp.config.json file to control application behavior and features. Use this file to define route and security rules, custom headers, and networking settings.

  • Build configuration: Define settings that control the build process.

  • Application settings: Set application-level settings and environment variables that can be used by backend APIs.

Example scenarios

If you want to... then...
Define routing rules Create rules in the staticwebapp.config.json file
Set which branch triggers builds Update the tracked branch name in the build configuration file
Define which security roles have access to a route Secure routes with roles in the staticwebapp.config.json file
Set which HTML file is served if a route doesn't match an actual file Define fallback route in the staticwebapp.config.json file
Set global headers for HTTP requests Define global headers in the staticwebapp.config.json file
Define a custom build command Set a custom build command value in the application configuration file
Set an environment variable for a frontend build Define an environment variable in the build configuration file
Set an environment variable for an API Set an application setting in the portal

Next steps