ASP.Net Core Reverse Proxy with different root

后端 未结 2 1177
刺人心
刺人心 2020-12-16 19:07

I am having problems proxying an ASP.NET Core MVC app.

My app is running on Kestrel on localhost:5000 and my Apache 2.4 reverse proxy is running on

2条回答
  •  一向
    一向 (楼主)
    2020-12-16 19:31

    The proxy is dropping request path information so you must re-introduce it by doing something like this:

    app.Use((context, next) => { context.Request.PathBase = "/test"; return next(); });

    This is different from what UsePathBase does, it moves path segments that are still there from the start of Path to the end of PathBase. https://github.com/aspnet/HttpAbstractions/blob/49b447d6265f0de44304b1b887cbdd3227cb038d/src/Microsoft.AspNetCore.Http.Abstractions/Extensions/UsePathBaseMiddleware.cs#L54

提交回复
热议问题