(Issue) Webrequest returning invalid 404/403

 

WebRequest with the same code called from the same type of computer on the same network can return mysterious 404 or 403 even though other computers on the same domain using the same code return server error 200 (ok).

Server is working with no issues. Code has no issues. Problem seems to reside in WebRequest itself. Unforunately I cannot provide the code as it has a private key in the WebRequest call.

Attempting to figure out what underlying libraries WebRequest is using and if those could be compromised. Looking for anyone on the forum that has in-depth information of how WebRequest works AND if it possibly reverts to consulting locally cached (broken) files instead of consulting the actual web server. 

 

WebRequest is a wrapper function around WinAPI, nobody knows exactly how except MetaQuotes devs.

Did you check what is send and receive as http data and mainly headers ?

 

Alain, both headers and body going into the 'WebRequest' call are empty (parameters in the webrequest are fed by using ?...&...&....)

I am trying to use Postman Proxy to catch the actual Request coming from MT5, but so far I haven't been able to catch that request.

I am assuming you're asking because MT5 internally adds a header to the outbound call? If so, could this header information be different on two different computers with the same architecture and on the same network? Also interesting is that everything was working fine on the 'bad' computer, up till last week, however without any intervention from my side, suddenly broke. It also 'broke' on a VPS (and on another VPS it is still working fine). 

I have also tried to change IP addresses on the 'bad' computer; what should be noted though (if we start discussing this) that the server does not 'block' any requests. It simply appears as if the call is not going outbound but gets stuck on a locally cached file(?) I have cleared browsing histories and done completely fresh installs of all Metatrader instances.

Return headers and server response code below. MT5 runtime error is 0.



 
Rob Josephus Maria Janssen #:

Alain, both headers and body going into the 'WebRequest' call are empty (parameters in the webrequest are fed by using ?...&...&....)

I am trying to use Postman Proxy to catch the actual Request coming from MT5, but so far I haven't been able to catch that request.

I am assuming you're asking because MT5 internally adds a header to the outbound call? If so, could this header information be different on two different computers with the same architecture and on the same network? Also interesting is that everything was working fine on the 'bad' computer, up till last week, however without any intervention from my side, suddenly broke. It also 'broke' on a VPS (and on another VPS it is still working fine). 

I have also tried to change IP addresses on the 'bad' computer; what should be noted though (if we start discussing this) that the server does not 'block' any requests. It simply appears as if the call is not going outbound but gets stuck on a locally cached file(?) I have cleared browsing histories and done completely fresh installs of all Metatrader instances.

The actual request needs to be checked to maybe figure out what is happening. There are several ways to do it, I never used Postman proxy. For there answer you certainly get some headers, not ?

Is it possible to add a dummy parameter to your request ? something like "...&dummy=123", it could allow to bypass a cache.

 
Rob Josephus Maria Janssen #:

Return headers and server response code below. MT5 runtime error is 0.

That's all ? Not much helpful unfortunately.
 

Great point changing the parameters to bypass any cache: no luck with that, still 404.

I am still trying to catch the request somehow but no luck so far

 
Alain Verleyen #:
what should be noted though (if we start discussing this) that the server does not 'block' any requests
Just to be sure. How do you know that ? You have access to the server and checked the logs ?
 
Alain Verleyen #:
Just to be sure. How do you know that ? You have access to the server and checked the logs ?
No I do not. But the Company running the server has. And from my end I have changed IPs
 
Rob Josephus Maria Janssen #:
No I do not. But the Company running the server has. And from my end I have changed IPs
You trust a company support answer ? 😄
 
Wow. I just changed IPs again and now it seems to be working. I have tried this multiple times but no luck before. I will refocus back on the Company running the server. Consider this issue closed for now. Thanks for sticking with me there Alain
 

For anyone having the same issue with WebRequest; please update to 5430. Issue was identified as a bug and resolved 

https://www.metatrader5.com/en/releasenotes

What's new in MetaTrader 5
What's new in MetaTrader 5
  • www.metatrader5.com
This version introduces a major upgrade to the charting engine.