签名后托管在 Azure 中的 Blazor Webassembly Azure AD 身份验证返回 404

时间:2021-04-29 09:23:09

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

我有 Blazor Webassembly 客户端应用程序,可以从 VS studio 完美运行,我在通过身份验证后使用 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

这里有什么问题?

1 个答案:

答案 0 :(得分:0)

发行人与 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”请求匹配的资源时重定向流量。

相关问题