Answer the question
In order to leave comments, you need to log in
How to set up routing between projects in ASP.NET Core 3.*?
Hello!
There is a main Project.WebApp project on ASP.NET Core 3.1, as well as another Project.Blog, which is located in the Features folder. It was decided to divide the project into components, but it is not entirely clear how to set up routing between them. Those. if I write " htpp://domen/Home " in the search bar , then everything works fine, because the HomeController is in the WebApp project, but if I need to go to the " htpp://domen/Blog " blog, then nothing happens, because to. The BlogController is in Project.Blog. Google has a similar solution on StackOverflow -> https://stackoverflow.com/questions/56721530/how-t... but something like this doesn't really work in my case. I think you get the point.
Answer the question
In order to leave comments, you need to log in
NET core recommend placing a reverse proxy.
So we read the official instructions
https://docs.microsoft.com/ru-ru/aspnet/core/host-...
<br>
server {<br>
listen 80;<br>
server_name example.com *.example.com;<br>
location / { # main location<br>
proxy_pass http://localhost:5000;<br>
proxy_http_version 1.1;<br>
proxy_set_header Upgrade $http_upgrade;<br>
proxy_set_header Connection keep-alive;<br>
proxy_set_header Host $host;<br>
proxy_cache_bypass $http_upgrade;<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
proxy_set_header X-Forwarded-Proto $scheme;<br>
}<br>
location /blog/ {<br>
proxy_pass http://localhost:5001;<br>
proxy_http_version 1.1;<br>
proxy_set_header Upgrade $http_upgrade;<br>
proxy_set_header Connection keep-alive;<br>
proxy_set_header Host $host;<br>
proxy_cache_bypass $http_upgrade;<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
proxy_set_header X-Forwarded-Proto $scheme;<br>
}<br>
}<br>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question