natemcmaster / dotnet-serve

Simple command-line HTTPS server for the .NET Core CLI

Home Page:https://nuget.org/packages/dotnet-serve/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for reverse proxy

doggy8088 opened this issue · comments

It can be useful to provide a proxy feature in the dotnet-serve that can serve some routes into another site to bypass Same-origin policy in the browser.

I'm open to taking this as a PR. Feel free to let me know if you want to implement it.

@natemcmaster Is it suitable to integrate https://github.com/Azure/reverse-proxy-dotnet into this project?

@natemcmaster In their samples, do you know why they are using app.UseWebSockets() to run the proxy? I don't understand what's the relationship between WebSockets and Proxy?

It allows forwarding websockets connections as well as regular HTTP requests

@natemcmaster For the command arguments/options, do you have any recommendation?

I prefer setting all the reverse proxy rules in the dotnet-serve.json-like file. e.g.

{
  "/api/{*path}": {
    "target": "http://back.end/api/{path}",
  },
  "/{*path}": {
    "target": "https://back.end/index.html",
  }
}

What do you think?

Let's keep it simple at first. I'll find some time to implement this feature. :)

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 7 days.