Apache HTTP 代理适用于某些目标 IP,并从其他目标接收 502 错误请求

Apache HTTP 代理适用于某些目标 IP,并从其他目标接收 502 错误请求

我有一个这样的 HTTP 代理:

Listen 8240
<VirtualHost *:8240>

ProxyRequests On

<Proxy "*">
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1
</Proxy>

</VirtualHost>

如果我尝试对某个 IP 进行 HTTP GET:

curl -v http://10.85.235.206:58000/ConnectionRequest -x 10.221.63.90:8240
* About to connect() to proxy 10.221.63.90 port 8240
*   Trying 10.221.63.90... connected
* Connected to 10.221.63.90 (10.221.63.90) port 8240
> GET http://10.85.235.206:58000/ConnectionRequest HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: 10.85.235.206:58000
> Pragma: no-cache
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 OK
< Date: Thu, 29 Apr 2021 10:53:29 GMT
< Server: Apache/2.4.46 (Unix)
< Content-Length: 0
* Connection #0 to host 10.221.63.90 left intact
* Closing connection #0

我收到 200 OK。

到另一个 IP:

curl -v http://10.74.170.178:58000/ConnectionRequest -x 10.221.63.90:8240 
* About to connect() to proxy 10.221.63.90 port 8240
*   Trying 10.221.63.90... connected
* Connected to 10.221.63.90 (10.221.63.90) port 8240
> GET http://10.74.170.178:58000/ConnectionRequest HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: 10.74.170.178:58000
> Pragma: no-cache
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 502 Bad Gateway
< Date: Thu, 29 Apr 2021 10:54:36 GMT
< Server: Apache/2.4.46 (Unix)
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=iso-8859-1
< Expires: Thu, 29 Apr 2021 10:54:36 GMT
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Bad Gateway</title>
</head><body>
<h1>Bad Gateway</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
</p>
</body></html>
* Connection #0 to host 10.221.63.90 left intact
* Closing connection #0

我收到 502 Bad Request。它们是两个不同的设备,第一个请求成功并响应 OK,第二个响应 502,但请求与 apache 2.4 http 代理相同。我必须更新我的 apache 配置才能与第二个设备正常工作。但我不明白其中的区别。如果我直接联系第二个设备而不使用 http 代理,它会响应 ok:

curl -v http://10.74.170.178:58000/ConnectionRequest 
* About to connect() to 10.74.170.178 port 58000
*   Trying 10.74.170.178... connected
* Connected to 10.74.170.178 (10.74.170.178) port 58000
> GET /ConnectionRequest HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: 10.74.170.178:58000
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: 
< Server: Apache/2.0.40 (Red Hat Linux)
< Content-Length: 21
<          Connection: close
< Content-Type: text/plain; charset=ISO-8859-1
Connection #0 to host 10.74.170.178 left intact
* Closing connection #0

为什么它不喜欢请求抛出代理?任何帮助都是宝贵的。非常感谢

相关内容