Answer the question
In order to leave comments, you need to log in
Curl+Proxy not working on server?
I am using Yii2 httpclient
$client = new Client(['transport' => 'yii\httpclient\CurlTransport']);
$response = $client->createRequest()
->setMethod('GET')
->setUrl($url)
->setHeaders([
'Connection' => 'keep-alive',
'sec-ch-ua' => '"Google Chrome";v="87", " Not;A Brand";v="99", "Chromium";v="87"',
'Accept' => 'application/json, text/javascript, */*; q=0.01',
'X-Requested-With' => 'XMLHttpRequest',
'sec-ch-ua-mobile' => '?0',
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36',
'Sec-Fetch-Site' => 'same-origin',
'Sec-Fetch-Mode' => 'cors',
'Sec-Fetch-Dest' => 'empty',
'Accept-Language' => 'ru,en-US;q=0.9,en;q=0.8'
])
->setOptions([
CURLOPT_PROXY => $this->proxy->getAddress(),
CURLOPT_PROXYUSERPWD => $this->proxy->getLogin() . ":" . $this->proxy->getPassword(),
])
->send();
Curl error: #56 - Received HTTP code 502 from proxy after CONNECT
Answer the question
In order to leave comments, you need to log in
https://success.outsystems.com/Support/Enterprise_...
HTTP Response Code 502 - Invalid Gateway Server indicates that the server, acting as a gateway or proxy, received an invalid response from an upstream server. In typical production scenarios, there is a reverse proxy or load balancers in front of the server(s). Imagine that the client sent a request to the Server. However, the client cannot do this directly, so it connects to the proxy by establishing a client>proxy connection. The proxy then creates a connection proxy. HTTP Error 502 - Invalid Gateway occurs in the following cases:
The proxy server timed out before the request was completed.
If the proxy>server connection drops.
When the response from the server is invalid
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question