title: ASP.Net Core Reverse Proxy with different root
body: <p>I am having problems proxying an ASP.NET Core MVC app.</p>
  
  <p>My app is running on Kestrel on <code>localhost:5000</code> and my Apache 2.4 reverse proxy is running on <code>localhost:80</code>. I want to proxy all requests from <code>localhost:80/test</code> to <code>localhost:5000</code></p>
  
  <p>Here is the <code>httpd.conf</code> part for the proxy:</p>
  
  <pre><code>...
  &lt;Location "/test"&gt;
     ProxyPass "http://localhost:5000"
     ProxyPassReverse "http://localhost:5000"
  &lt;/Location&gt;
  ...
  </code></pre>
  
  <p>The proxy works, however all links are broken. Like if I have an anchor that links to a controller named <code>HomeController</code> with the action <code>About</code>, the link returned from the proxy is <code>localhost/Home/About</code> instead of <code>localhost/test/Home/About</code>. The host is correct, it's the context root <code>test</code> that is missing.</p>
  
  <p>What is the best practice to handle this? Is it a configuration in ASP.NET Core to specify the context root so that TagHelpers will take it into account? Or is it a configuration in Apache <code>ProxyPass</code> to rewrite links (really not a big fan of this)?</p>