标签: azure-static-web-app-routing

将 Azure 静态 Web 应用程序从裸域重定向到 www

我已经设置了带有自定义域的 Azure 静态 Web 应用程序。example.com 和www.example.com均已正确设置并运行。

我现在想在 staticwebapp.config.json 中创建一些规则,以便所有传入https://example.com/ * 的请求都将重定向到https://www.example.com/ *。

有没有办法做到这一点?我知道我可以使用前门或类似的方式来完成此操作,但是我可以通过静态 Web 应用程序中的规则来完成此操作吗?

azure azure-static-web-app azure-static-web-app-routing

6
推荐指数
1
解决办法
1933
查看次数

如何在 Azure Devops 版本部署 Azure 静态 Web 应用中找到我的 staticwebapp.config.json?

我有一个为我的Angular应用程序构建 artificat 的管道。在我尝试访问特定 URL 之前,部署工作正常。它将我重定向到 404。这与staticwebapp.config.json. 看起来像:

{
  "navigationFallback": {
    "rewrite": "/index.html",
    "exclude": ["*.{css,scss,js,png,gif,ico,jpg,svg}"]
  }
}
Run Code Online (Sandbox Code Playgroud)

我在 Azure Devops 中创建了一个发布管道,将其发布到Azure 上的静态 Web 应用程序。这就是我的.yaml样子:

steps:
- task: AzureStaticWebApp@0
  displayName: 'Static Web App: '
  inputs:
    workingDirectory: '$(System.DefaultWorkingDirectory)/xx/xx/xx-xx-web'
    app_location: /
    output_location: dist
    config_file_location: configuration
    skip_app_build: true
    skip_api_build: true
    is_static_export: false
    verbose: true
    azure_static_web_apps_api_token: 'SOMEVALUE'
Run Code Online (Sandbox Code Playgroud)

staticwebapp.config.json 位于此处:

  • 源代码
    • 应用程序
    • 资产
    • 配置
      • 静态webapp.config.json

这是我在发布过程中遇到的错误:

##[error]routes_location: route file 'staticwebapp.config.json/routes.json' could not be found.
Run Code Online (Sandbox Code Playgroud)

或者当我填写config_file_location

##[error]config_file_location: config file …
Run Code Online (Sandbox Code Playgroud)

azure-devops angular azure-static-web-app azure-static-web-app-routing

3
推荐指数
1
解决办法
3785
查看次数