microsoft / reverse-proxy

A toolkit for developing high-performance HTTP reverse proxy applications.
https://microsoft.github.io/reverse-proxy
MIT License
8.59k stars 842 forks source link

Blazor behind YARP not working #2640

Closed rborosak closed 1 month ago

rborosak commented 1 month ago

Hi, I have a .NET 8 blazor app that is working inside an internal network. The blazor app has a base href defined in the _Host.cshtml

<base href="/app/" />

The app is published on the IIS as an application inside a Default web site

It works on the internal network by navigating on https://internalnetworkaddress/app

Now I need to expose the blazor app on the external network and I have set up a YARP as a reverse proxy. YARP is delpoyed on the server that has an external address as an application inside a Default web site on IIS.

The idea is that the app should still be available to the users from the internal network and the users from the external network by navigating to https://extarnalnetworkaddress/proxy/app

The appsettings.json looks like this

"ReverseProxy": { "Routes": { "route_app": { "ClusterId": "cluster_app", "Match": { "Path": "/app/{**catch-all}" } } }, "Clusters": { "cluster_app": { "Destinations": { "cluster_app/destination_app": { "Address": "https://internalnetworkaddress/", } } } } }

And this does not work.

In order to get it working I need to change the base href of my blazor app to <base href="/proxy/app/" />

Am I doing something wrong? I would like to avoid changing the base href of the app.

Thank you