titanium-web-proxy
                                
                                 titanium-web-proxy copied to clipboard
                                
                                    titanium-web-proxy copied to clipboard
                            
                            
                            
                        Google reCaptcha fails via Proxy
Hello, I am trying to load the page https://isales.trcont.com/#/tracking it contains captcha script on the page.
My idea is to load the page with fake domain address e.g. test.test.

And captcha fails with Error: invalid domain key.
But it works fine with free web proxy - https://hosteagle.club/

I start the proxy with code provided in sample.
Implement domain changing onRequest with the code:
            if (e.HttpClient.Request.Host.Contains("test.test"))
            {
                e.HttpClient.Request.RequestUri = new Uri(e.HttpClient.Request.Url.Replace("test.test", "isales.trcont.com"));
                string[] headers = new[] { "Host", "Origin", "Referer" };
                foreach (var header in headers)
                {
                    var h = e.HttpClient.Request.Headers.GetHeaders(header)[0];
                    e.HttpClient.Request.Headers.RemoveHeader(h);
                    h = new HttpHeader(h.Name, h.Value.Replace("test.test", "isales.trcont.com"));
                    e.HttpClient.Request.Headers.AddHeader(h);
                }
            }
And onResponse:
            if (e.HttpClient.Request.Method == "GET" || e.HttpClient.Request.Method == "POST")
            {
                if (e.HttpClient.Response.StatusCode == (int)HttpStatusCode.OK)
                {
                    if (e.HttpClient.Response.ContentType != null && e.HttpClient.Response.ContentType.Trim().ToLower().Contains("text/html") || e.HttpClient.Response.ContentType.Trim().ToLower().Contains("application/j"))
                    {
                        string body = await e.GetResponseBodyAsString();
                        body = body.Replace("test.test", "isales.trcont.com");
                        e.SetResponseBodyString(body);
                    }
                }
            }
So, what am I doing wrong? Any ideas?
I would appreciate for any help.
I'm sure that reCaptcha is encoding/adding to the request/using the hash of the client url somehow. Probably the cookies are also valid only for a specific domain, too. It is not that easy to cheat reCaptcha.. there are smart guys at Google.
It would need a lot of development hours to investigate it. You can check recaptcha source, where is it using the client url... and replace that part of the script with TWP, but it is a lot of work. We are not providing that type of support.
By the way, I don't understand this line of code in the onResponse:
body = body.Replace("test.test", "isales.trcont.com");
Normally the response should not contain test.test, scince the goal is to replace everything in the onRrequest, and change back in the onResposne. However it does not solve the problem if you switch the parameters.