Skip to content

Deployment guidance of Hosted Blazor WASM under a sub-path #24003

@LeaFrock

Description

@LeaFrock

I have a hosted blazor wasm app, and I want to deploy it under a sub-path like https://xxx.mydomain.com/blazor , with nginx.
I've deployed the blazor app on the server(127.0.0.1:5001) and finished the nginx configurations like below,

location /blazor {
            proxy_pass http://127.0.0.1:5001;
            limit_req  zone=one burst=60 nodelay;
        }

A hosted blazor wasm has two parts, server side(web api) and client side(blazor wasm). On the server side, I've configured UsePathBase("/blazor") in Startup.cs. If it's just a ASP.NET Core Web API app, it works. But the blazor app returns a lot of 404 http code of static files as the broswer still visits them with urls like https://xxx.mydomain.com/assets/xxx instead of https://xxx.mydomain.com/blazor/assets/xxx.

I've read issues like #14999 or #15464, but still not find a perfect answer. I think a related doc is required.
Any help? Thanks in advance!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions