Purpose, when my own server requests someone else's interface, there may be request restrictions, or my IP is blocked and I cannot request through my IP address.To put it bluntly, your server cannot send or request content directly to the target server.
Two ways can solve it: 1. Use proxy IP; 2. Reverse proxy (request forwarding)
Using a proxy IP request, it is annoying to use, there is no difficulty, we use a reverse proxy to implement this time, the definition is as follows:
Reverse proxy refers to the proxy server to accept connection requests on the Internet, then forward the request to the server on the internal network, and return the results obtained from the server to the client requesting the connection on the Internet. In fact, nginx can quickly set up a reverse proxy, but for cost reasons! I gave up on nginx because nginx requires the purchase of a server, and I want to just buy a asp.net space to implement the function of a reverse proxy.
On the Internet, I didn't find a good example, so let's write a simple one yourself!
Reference articles:
Supports get, post requests, tests as follows:
Here's how to use it: First, purchase a space that supports asp.net, and then upload the website to the root directory of the space.
In the web.config file, find the appsetting node and replace the value value in host!
Source code download:
Tourists, if you want to see the hidden content of this post, please Reply
|