This article is a mirror article of machine translation, please click here to jump to the original article.

View: 374057|Reply: 119

[ASP.NET] asp.net Implement the reverse proxy function [Source code]

  [Copy link]
Posted on 3/14/2018 12:01:13 PM | | | |
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:

asp.net IHttpModule interface is explained in detail
http://www.itsvse.com/thread-4580-1-1.html
(Source: Architect_Programmer)

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, pleaseReply








Previous:C# must modify this header workaround with the appropriate attributes or methods
Next:The difference between IIS7 Classic mode and integrated mode
 Landlord| Posted on 3/14/2018 12:41:51 PM |
iis in classic mode with an error: System.Web.HttpException: Failed to execute URL

Solution:


Posted on 12/23/2020 11:57:26 AM |

Learn to learn 1
Posted on 1/2/2019 3:45:17 PM |
Learn to learn 1
Posted on 3/15/2018 10:24:01 AM |
Hello, I hope you can take a look at the source code.
Posted on 3/15/2018 2:58:56 PM |
Thank you for sharing, let's take a look
Posted on 3/20/2018 10:35:11 AM |
Take a look at the source code
Posted on 3/22/2018 11:12:26 AM |
Thai U one U coin coveted Ou Wei Ou sent a red envelope for the European service to report my lack of it
Posted on 4/6/2018 8:56:07 PM |
Not bad, yes, reference
Posted on 4/11/2018 4:19:47 PM |
Thank you for sharing... Download the study
Posted on 4/15/2018 2:50:32 PM |
Thank you for sharing, let's take a look
Posted on 4/18/2018 9:44:44 AM |
Let me take a look
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com