chronoxor / NetCoreServer

Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
https://chronoxor.github.io/NetCoreServer
MIT License
2.74k stars 566 forks source link

Reverse Proxy? #142

Open derekantrican opened 3 years ago

derekantrican commented 3 years ago

Pardon terminology and whatnot - I'm very new to all the network admin stuff of ports, proxies, etc

I have NetCoreServer set up on my home network handling public internet requests to port 8080 (which are forwarded to the localhost:8080 port). I have other applications running on my local network only (not exposed via port forwarding) - eg ports 1234 & 5678. I'd like to utilize NetCoreServer to handle some specific requests (eg PUBLIC_IP:8080/myapp) and display the content at localhost:1234. According to https://superuser.com/questions/1547937/having-multiple-web-services-run-at-home-on-the-same-ports-80-and-443, it seems like I need a "reverse proxy" (which I am entirely unfamiliar with). Is this something NetCoreServer can do already? If not, could this be added?

If this isn't already a part of NetCoreServer, this seems like a decent place to start: https://auth0.com/blog/building-a-reverse-proxy-in-dot-net-core/

FranklyBrandon commented 3 years ago

Normally in production / deployed environments a reverse proxy server sits in front of your application, but behind the server's firewall, forwarding requests to the appropriate backend application that will ultimately service the network request. It provides things like caching, load balancing, and security. In your case it would allow multiple applications to run on the same server (localhost) because the reverse proxy would forward some requests to one application and some to the other.

Reverse proxy servers in deployed environments are not intended to be bundled with your server code like you are suggesting. Reverse proxy servers can be configured and run on a server separate from the backend server applications. I've had a lot of success deploying .NET servers (ASP.NET and console apps like NetCoreServer) using NGINX

asheroto commented 2 years ago

@derekantrican this is an offbeat solution, but I'ved used frp a lot for reverse proxies. Yes, it's written in go, but it's very configurable if you just use the binaries and ini config files. Works great.