Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blazor server side behind reverse proxy 404

I have a blazor server-side app hosted on IIS behind a reverse proxy (using ARR).

I have tried everything I can think of, but I keep getting 404 on

_framework/blazor.server.js

My base href is is set to "/subsite/":

<base href="/subsite/" />

and all my src values are relative like this:

<script src="_framework/blazor.server.js"></script>
<script src="_content/BlazorInputFile/inputfile.js"></script>
<script src="animations.js"></script>

Every other script ref loads fine, EVEN the _content data, but not the blazor.server.js.

I tried the old PathBase trick for MVC apps as well with no success:

if (!env.IsDevelopment()) {
    app.Use((context, next) => {
        context.Request.PathBase = new PathString("/subsite");
        return next();
    });
}

Can anyone tell me how to make Blazor realize where to put the blazor.server.js in a reverse proxy scenario?

like image 722
Dynde Avatar asked Oct 23 '19 07:10

Dynde


1 Answers

Did you try the UsePathBase ?

app.UsePathBase("/subsite");

Here is my test result

test result

Please check this article for more https://www.billbogaiv.com/posts/net-core-hosted-on-subdirectories-in-nginx

like image 148
BlazorPlus Avatar answered Oct 08 '22 12:10

BlazorPlus