【问题标题】:Blazor Webassembly Azure AD authentication hosted in Azure return 404 after signing在 Azure 中托管的 Blazor Webassembly Azure AD 身份验证在签名后返回 404
【发布时间】:2021-07-22 15:43:38
【问题描述】:

我有可以从 VS studio 完美运行的 Blazor Webassembly 客户端应用程序,我在通过身份验证后使用 docker 进行部署,它返回 404,我已经部署到 Azure 并且遇到了同样的错误。

返回路径在 Azure AD 中设置正确。

我的 docker 文件

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source

# copy csproj and restore as distinct layers
COPY ./clientApp/. ./clientApp/

FROM build AS publish
WORKDIR /source/clientApp/
RUN dotnet publish -c release

FROM nginx AS runtime

COPY --from=publish /source/clientApp/bin/release/netstandard2.1/publish/wwwroot/. /usr/share/nginx/html/.
ADD ./clientApp/default.conf /etc/nginx/conf.d/default.conf

错误

http://localhost:8080/authentication/login-callback#id_token= <tokenvalue>" // 404 not found nginx 1.19.10

这里有什么问题?

【问题讨论】:

    标签: azure docker azure-active-directory dockerfile blazor-webassembly


    【解决方案1】:

    问题与 Nginx 配置错误有关,请参阅 https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-5.0 Nginx 部分。

    我通过添加以下内容来更新我的 Nginx 配置文件:

    ...
     location / {
                root      /usr/share/nginx/html;
                try_files $uri $uri/ /index.html =404;
            }
    ...
    

    Nginx 将在找不到与请求匹配的资源时重定向流量到 'index.html'。

    【讨论】:

      猜你喜欢
      • 2020-11-06
      • 2022-08-16
      • 2021-09-20
      • 1970-01-01
      • 1970-01-01
      • 2022-10-22
      • 1970-01-01
      • 2022-01-11
      • 1970-01-01
      相关资源
      最近更新 更多