http - Apache HTTP 代理为某些目标 IP 工作并从其他目标接收 502 Bad Request
问题描述
我有一个这样的 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 错误请求。它们是两个不同的设备,第一个喜欢请求并响应 OK,第二个响应 502 但请求与相同的 apache 2.4 http 代理相同。我必须更新我的 apache 配置才能与第二个设备一起正常工作。但我不明白其中的区别。如果我在没有 http 代理的情况下直接联系第二台设备,它会响应正常:
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
为什么它不喜欢请求抛出代理?任何帮助都是宝贵的。非常感谢
解决方案
推荐阅读
- python - 按索引分配列表列表的元素设置列表的所有第一个元素
- django - 需要 OAuth 身份验证的 Django 单元测试
- hive - Hive:将 gziped CSV 从 hdfs 以只读方式加载到表中
- laravel - 雄辩的 - 检查一个属性的两种可能性
- javascript - 如何使用 webpack 加载 web 组件
- r - 将多个字符向量转换为日期,应用在 R 中返回一个数字
- c# - 对 Office365 Graph 进行 API 调用
- c++ - 关于默认构造函数,C++ OOP 中的对象初始化/使用
- algorithm - 从一个源经过 N 条边的最短路径
- android - Manifest 合并失败如何解决?