c# code in VS, I tried either WebClient, HttpClient OR HttpWebRequest, sending a post to an url, but always get 502 bad gateway error, however, the post works fine , return 200OK in fiddler or postman
BTW, same code works fine on another machine. guess sth wrong with my machine setting, anything I can check why?
If the error persists, there is a chance that your browser cache has saved outdated and corrupted files. In this case, clearing the browser cache can fix an HTTP 502 Bad Gateway error. Keep in mind that removing cached files might risk you losing important browser data, including bookmarks and setting preferences.
A 502 bad gateway message indicates that one server got an invalid response from another. In essence, you've connected with some kind of interim device (like an edge server) that should fetch all of the bits you need to load the page. Something about that process went wrong, and the message indicates the problem.
all right, I am answering it myself, turns out it is a code issue but I am not sure why, I have to set client.DefaultRequestHeaders.ExpectContinue = false;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With