Host ASP.NET Core behind Apache in domain subfolder

Viewed 889

I am doing the tutorial for a ASP.NET Core web app with Razor pages found here: https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages-vsc/model?view=aspnetcore-2.1

I want to deploy my published site to my webserver at www.mydomain.com/coretutorial and found this guide on how to setup a reverse proxy with Apache https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-2.1&tabs=aspnetcore2x

The thing is that the guide assumes that I will host the app in my domains root, i.e. www.mydomain.com . I tried changing my reverse proxy setup to

ProxyPreserveHost On
ProxyPass /coretutorial http://localhost:5000/
ProxyPassReverse /coretutorial http://localhost:5000/

and it will serve the index page for my web app but a lot of the resources will fail to load and the links to other pages don't work.

Is this something that I can fix somewhere in my web apps configuration or is this an Apache problem?

1 Answers
<VirtualHost yourhost.yourdomain.com:80>
      ServerName yourhost.yourdomain.com

      <Location /demo/>
         ProxyPass http://localhost:5000/
         ProxyPassReverse http://localhost:5000/
      </Location>
 </VirtualHost>
Related