Strange 502 error connecting to Fiddler Classic

1 Answer 1404 Views
Fiddler Classic Windows
Varun
Top achievements
Rank 1
Iron
Varun asked on 24 Mar 2022, 10:09 AM | edited on 24 Mar 2022, 10:11 AM

This is what I am using

1. Proxifier

2. Fiddler Classic

My code makes web requests which are intercepted by Proxifier and forwarded to Fiddler Classic. 

Note: All 3 are on the same dev machine (127.0.0.1).

Earlier it was working smooth, now I get strange 502 errors in Proxifier. It happens randomly and only once every 10-15 requests. When I retry the curl request in my code, it executes successfully next time even without a sleep condition / any delay.

Note:

A) While I see the 502 error in the Proxifier log, the failed request is not visible in the Fiddler requests list. I am not sure what is the problem?

B) I only face this issue when using one particular API from eodhistoricaldata.com. I never face this issue if I use other API endpoints from the same provider

C) It started randomly few days ago. Before that, the code was working fine.

[03.24 15:33:50] php.exe - eodhistoricaldata.com:443 close, 1193 bytes (1.16 KB) sent, 2206 bytes (2.15 KB) received, lifetime <1 sec
[03.24 15:33:50] php.exe - eodhistoricaldata.com:443 open through proxy 127.0.0.1:8888 HTTPS
[03.24 15:33:56] php.exe - eodhistoricaldata.com:443 close, 1194 bytes (1.16 KB) sent, 441336 bytes (430 KB) received, lifetime <1 sec
[03.24 15:34:00] php.exe - eodhistoricaldata.com:443 open through proxy 127.0.0.1:8888 HTTPS
[03.24 15:34:01] php.exe - eodhistoricaldata.com:443 close, 1191 bytes (1.16 KB) sent, 16082 bytes (15.7 KB) received, lifetime <1 sec
[03.24 15:34:22] php.exe (32564) - eodhistoricaldata.com(134.209.140.199):443 error : Could not connect through proxy 127.0.0.1(127.0.0.1):8888 - Proxy server cannot establish a connection with the target, status code 502
[03.24 15:34:22] php.exe - eodhistoricaldata.com:443 open through proxy 127.0.0.1:8888 HTTPS
[03.24 15:34:23] php.exe - eodhistoricaldata.com:443 close, 1192 bytes (1.16 KB) sent, 2206 bytes (2.15 KB) received, lifetime <1 sec

 

Nick Iliev
Telerik team
commented on 24 Mar 2022, 10:19 AM

Receiving status code 502 on a random occasion could resultfrom many different issues. Check this SO thread for some possible reasons & solutions.
Varun
Top achievements
Rank 1
Iron
commented on 24 Mar 2022, 12:14 PM

@Nick I went through both the links but no luck with anything.

1 Answer, 1 is accepted

Sort by
0
Accepted
Varun
Top achievements
Rank 1
Iron
answered on 24 Mar 2022, 12:22 PM | edited on 24 Mar 2022, 12:24 PM

I did some more debugging without using Fiddler.

It seems like the API has changed 

Now this endpoint is returning this error randomly

*   Trying 134.209.140.199:443...
* TCP_NODELAY set
* connect to 134.209.140.199 port 443 failed: Connection refused
* Failed to connect to eodhistoricaldata.com port 443: Connection refused
* Closing connection 0
curl: (7) Failed to connect to eodhistoricaldata.com port 443: Connection refused
Elcio
Top achievements
Rank 1
commented on 20 May 2022, 12:16 AM

Varun, i have the same problem with EOD. Using php CURL request, I got refuse. If you have any news or solution I apreciate.

Because it suddenly stopped to work I think is not related to my code but to them.

I sent an e-mail and they said that there is no firewall or similar protection.

I still looking for the solution. If I do not find a solution I need to replace EOD for other API partner.

Varun
Top achievements
Rank 1
Iron
commented on 20 May 2022, 11:08 AM

I ended up solving a wrapper by creating a wrapper around curl. Something like this

 

function curl2() {

for ($i=0; $i<10; $i++) {

result = make_curl_request();

if (result == false){

sleep(1);

} else {

break;

}

}

Varun
Top achievements
Rank 1
Iron
commented on 20 May 2022, 11:09 AM

    $triesAllowed = 60;
    while (true) {
        $response = curl_exec($ch);
        $info = curl_getinfo($ch);

        if ($info['header_size'] == 0 || $response === FALSE) {
            // Internet not working (most likely)
            if (defined('STDIN')) {
                var_dump('================================================================');
//                echo json_encode($info) . "\n";
                var_dump($response);
                echo json_encode((debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS))) . "\n";
                var_dump('curl2() Failed for the URL ' . $url . ' - ' . $info['url']);
                var_dump('================================================================');
            }
            if ($triesAllowed > 0) {
                sleep(1);
            } else {
                var_dump('Press Enter to exit');
                fgetc(STDIN);
                die;
            }
            $triesAllowed--;
        } else {
            break;
        }
    }
Elcio
Top achievements
Rank 1
commented on 21 May 2022, 01:39 AM

Hi Varun. I discover that the firewall of the system was blocking that IP due to the exceeding amount of connections. Thanks for your support. Have a nice day. 
Tags
Fiddler Classic Windows
Asked by
Varun
Top achievements
Rank 1
Iron
Answers by
Varun
Top achievements
Rank 1
Iron
Share this question
or