Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ReverseProxy" is the simplest and most practical way is to support powershell ! #167

Open
kasini3000 opened this issue May 15, 2020 · 7 comments
Labels
Type: Idea This issue is a high-level idea for discussion.
Milestone

Comments

@kasini3000
Copy link

kasini3000 commented May 15, 2020

Microservices, docker and asp.net core applications require api gateways.app need add and delete backends with commands.

Performance should not be a priority,
The configuration file format should not be a priority.
Supporting the command line is the priority.

"ReverseProxy" is the simplest and most practical way is to support powershell !
Can ReverseProxy support command interface support?
If the reverse proxy can support command interface support, it is excellent.

powershell 7.1 preview uses .net core 5,
powershell 7.0 uses .net core 3.1,
Powershell uses ConvertFrom-Json to convert json to .net hash table object.

I think the simplest and most practical way is:
release ReverseProxy dll and make a powershell module to https://www.powershellgallery.com/

Use the powershell command to add .net object:
Add-ReverseProxy -name 'server1' -ipaddress '192.168.0.1'
Remove-ReverseProxy -name 'server1' -ipaddress '192.168.0.1'

and then sync "server1.json" to the disk configuration file every 10 seconds. The format of the configuration file is not important.

Start-ReverseProxy -listenip '1.2.3.4'
Stop-ReverseProxy

Add-UrlRewrite -name 'aaa' -base 'http://192.168.0.1' -url '/a/b' -Rewriteto 'xxx'
Remove-UrlRewrite

by the way:
Recently, my project needs a reverse proxy. When will it be released?

@kasini3000 kasini3000 added the Type: Idea This issue is a high-level idea for discussion. label May 15, 2020
@OxYGC
Copy link

OxYGC commented May 15, 2020

good lssues!!!

@samsp-msft
Copy link
Member

Different customers want different features - I respect the desire for a powershell configuration API. That will need to have a way to talk to the proxy service, which may well be on a different host or in a container, and so I would suggest that a starting point would be to have a REST or gRPC endpoint that can configure the proxy. A powershell module would then be able to talk to that API to do the configuration. The biggest complication will be auth - as you want to authenticate and authorize who can change proxy config.

#125 tracks a REST/gRPC endpoint.

@samsp-msft
Copy link
Member

In terms of shipping, then goal is for 1.0 to be around the same time as .NET 5. It depends on what feature sets are required by customers for it to be considered a viable product.

@kasini3000
Copy link
Author

kasini3000 commented May 16, 2020

Q: How to let powershell add a backend server to YARP?
A:
1 powershell 7.1 preview (based on .net core 5) Call the powershell YARP module. The module adds a backend through the static method of .net core 5 of YARP.

**Every day, every version, developers can change the configuration file format and data structure. No need to consider compatibility,
Using this method will allow you to never consider the method reconstruction problem:

[YARP.version5] :: method1()
[YARP.version6] :: method1()

be better than 2.**

2 YARP listen 127.0.0.1:12345, and then powershell adds the back-end server through REST without auth

Q: Will YARP provide compatibility with .net core 3.1?
A:
will not. You can use the .net core3.1 client to access YARP through the command line, after ssh, there is a powershell command line interface. This command line interface is compatible with any external calls such as win, linux, python, etc.

user app want add back end to YARP--->commandline--->ssh client---> ssh server--->
powershell YARP module (powershell 7.1 preview base .net core 5)
---> the static method of .net core 5 of YARP
powershell eg:
1 Add-Type -Path "d:\yarp.dll" or "/xxx/yarp.dll"
2[YARP]::add_urlrewrite('http://11/aa/bb','http://22/cc/dd')

in windows:winrm client --->winrm server

@kasini3000
Copy link
Author

api getway "kong" urlrewrite use 【nginx + lua + 127.0.0.1+curl】,we can use 【yarp + powershell + .net core method,property】

@davidfowl
Copy link
Member

Not something we’re going to build into yarp, at least not in v1. I think it’s fine to fork or build an addon for something like this and see where the interest lies.

@kasini3000
Copy link
Author

@davidfowl Powershell is here to help yarp, not to ask yarp for something.

1 powershell helps yarp to expose .net core class, method, property, and you do n’t need to do anything at first.
Benefits are:
You can change the api and configuration file format for each version every day without considering compatibility and without telling the user. You only need to write a sample ps1 script:
[YARP.version5] :: add_urlrewrite ('http: // 11 / aa / bb', 'http: // 22 / cc / dd')

2 In the end you need to make a powershell module:
Add-UrlRewrite -name 'aaa' -base 'http://192.168.0.1' -url '/ a / b' -Rewriteto 'xxx'

You can assign this task to others, or do it one year later . it just makes the command look more elegant, without this module, you can do it with the above command.

@samsp-msft samsp-msft added this to the Backlog milestone May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Idea This issue is a high-level idea for discussion.
Projects
None yet
Development

No branches or pull requests

4 participants