This is a migrated thread and some comments may be shown as answers.

Setting responseCode for https response

2 Answers 756 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Iwan asked on 30 Mar 2020, 02:34 PM


I'm making an api call and trying to modify the status code in the https response but the response is failing without returning a status code and I'm also getting a ERR_TUNNEL_CONNECTION_FAILED.

I can see my https request coming in. Also managed to modify/add headers on the response to test if my code in the ScriptEditor works - works fine.

NOTE: The status code changes also works fine for http request.


I am probably missing something simple, here is the code below. For testing I also checked other https calls from different sites and the same is happening.

In OnBeforeResponse I have: oSession.responseCode = 500;


Any ideas?


2 Answers, 1 is accepted

Sort by
Eric R | Senior Technical Support Engineer
Telerik team
answered on 31 Mar 2020, 04:17 PM

Hi Iwan,

Unfortunately, that error is a general error that can be used as a catch-all for different scenarios. 

My first guess is that HTTPS isn't enabled. Can you confirm that Decrypt HTTPS is enabled?

If HTTPS decryption is enabled and you continue to receive the error, I will need the following information to troubleshoot this further. 

1. Can you provide a Session Archive of the API calls?

2. Can you provide the output of the Fiddler Log tab?

3. Does your API application use HTTPS?

4. What client are you using to access your API?

5. Is the API hosted locally or in a remote server?

6. Do you have any other software like a VPN or Firewall running?

7. Any screenshots or other errors that you may find relevant to the issue.

Once I have the above information I can aide in troubleshooting in more detail.

In the meantime, please let me know if you need any additional information. Thank you for using the Fiddler forums.


Eric R | Senior Technical Support Engineer
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Top achievements
Rank 1
answered on 01 Apr 2020, 10:58 AM

Hi Eric,


Thank you for coming back to me. I have resolved the issue using the AutoResponder instead of trying to set the responseCode in the script editor.


What I did:

1) On the Tools > Options > HTTPS tab. Tick Decrypt HTTPS traffic. Following instructions regarding certificates etc.

2) On the AutoResponder tab Add a rule:

If request matches: METHOD:GET<host name>

then respond with: 400_BadRequest.dat

3) Contents of 400_BadRequest.dat (you can change the 400 to any other error code):

HTTP/1.1 400 Bad Request
FiddlerTemplate: True
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, PATCH, OPTIONS
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
Access-Control-Max-Age: 86400
Date: Fri, 25 Jan 2013 16:49:29 GMT
Content-Type: application/json
Content-Length: 520

{"message": "400 Bad Request"}


Asked by
Top achievements
Rank 1
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
Top achievements
Rank 1
Share this question