简体   繁体   中英

How can i reverse proxy using Titanium-Web-Proxy?

I have used Titanium-Web-Proxy for reverse proxy. where i can specify server back-end Ip Address?. I have added end point and also the service started with endpoint. But it could not connect with backend IP Address. Titanium-Web-Proxy

public void StartProxy()
        {
            proxyServer.BeforeRequest += OnRequest;
            proxyServer.BeforeResponse += OnResponse;
            proxyServer.ServerCertificateValidationCallback += OnCertificateValidation;
            proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;


            var transparentEndPoint = new TransparentProxyEndPoint(IPAddress.Parse("x.x.x.x"), 5001, true)
            {
                GenericCertificateName = "test"

            };

            proxyServer.UpStreamHttpProxy = new ExternalProxy() { HostName = "x.x.x.x", Port = 5000};
            proxyServer.AddEndPoint(transparentEndPoint);
            proxyServer.Start();



        }

please any one help me to add backend IP and provide a samples to authenticate backend IP.

Thanks,
Selva

In addition to my comments about the current version (2016/10/06) which they call 1.0.1 in the assembly properties. I believe the intended way to change requests to a backend server is through the BeforeRequest event handler, eg.

    public async Task OnRequest(object sender, SessionEventArgs e)
    {

        string newhost = "http://localhost";
        Uri u = e.WebSession.Request.RequestUri;
        e.WebSession.Request.RequestUri = new Uri(newhost + u.AbsolutePath);

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM