Apache2反向代理不断返回407错误

时间:2019-07-14 00:52:48

标签: apache ubuntu proxy apache2 reverse-proxy

在过去的15个小时里,我一直无法解决这个问题,完全没有运气,因此,我感谢每个人的见识。

因此,我使用apache2进行了反向代理设置,该设置以前工作正常。我有1000个虚拟主机设置,所有虚拟主机都指向127.0.0.1上的另一组端口,然后通过socat路由到后端服务器。

问题是我正在尝试使用代理,但是每次使用代理时,它只会显示407错误。密码正确,用户名正确,日志中完全没有错误,我很困惑。输入错误的密码后,apache将其记录在error_proxy.log中,提示“ Password Mismatch”,但在我的情况下,我遇到407错误,并且未在日志中输入任何内容。

apache2.conf (我仅包括前2个虚拟主机,因为其他1000个虚拟主机与增量端口相同)

<VirtualHost *:2000>
 ProxyRequests On
 ProxyVia On
 ProxyRemote * http://127.0.0.1:16000
 <Proxy *>
  Order deny,allow
  Allow from all
  AuthType Basic
  AuthName "Authentication Required"
  AuthUserFile /etc/apache2/user_passwd
  # Port 2000
  Require ip x.x.x.x
  Require valid-user
 </Proxy>
 ErrorLog /var/log/apache2/error_proxy.log
 LogFormat "%t %{ms}T %a \%{local}p\ %u %m %>s %U %S" proxy
 CustomLog /var/log/apache2/access_proxy.log proxy
</VirtualHost>
<VirtualHost *:2001>
 ProxyRequests On
 ProxyVia On
 ProxyRemote * http://127.0.0.1:16001
 <Proxy *>
  Order deny,allow
  Allow from all
  AuthType Basic
  AuthName "Authentication Required"
  AuthUserFile /etc/apache2/user_passwd
  # Port 2001
  Require ip x.x.x.x
  Require valid-user
 </Proxy>
 ErrorLog /var/log/apache2/error_proxy.log
 LogFormat "%t %{ms}T %a \%{local}p\ %u %m %>s %U %S" proxy
 CustomLog /var/log/apache2/access_proxy.log proxy
</VirtualHost>

在调试日志记录模式下的error_proxy.log

[Sat Jul 13 19:57:46.058855 2019] [core:debug] [pid 32711:tid 140509913736960] vhost.c(1170): [client x.x.x.x:59885] AH02417: Replacing host header 'google.com' with host 'google.com' given in the request uri
[Sat Jul 13 19:57:46.058914 2019] [authz_core:debug] [pid 32711:tid 140509913736960] mod_authz_core.c(809): [client x.x.x.x:59885] AH01626: authorization result of Require ip x.x.x.x: denied
[Sat Jul 13 19:57:46.058920 2019] [authz_core:debug] [pid 32711:tid 140509913736960] mod_authz_core.c(809): [client x.x.x.x:59885] AH01626: authorization result of Require valid-user : denied (no authenticated user yet)
[Sat Jul 13 19:57:46.058923 2019] [authz_core:debug] [pid 32711:tid 140509913736960] mod_authz_core.c(809): [client x.x.x.x:59885] AH01626: authorization result of <RequireAny>: denied (no authenticated user yet)
[Sat Jul 13 19:57:46.059185 2019] [authz_core:debug] [pid 32711:tid 140509913736960] mod_authz_core.c(809): [client x.x.x.x:59885] AH01626: authorization result of Require ip x.x.x.x: denied
[Sat Jul 13 19:57:46.059188 2019] [authz_core:debug] [pid 32711:tid 140509913736960] mod_authz_core.c(809): [client x.x.x.x:59885] AH01626: authorization result of Require valid-user : granted
[Sat Jul 13 19:57:46.059191 2019] [authz_core:debug] [pid 32711:tid 140509913736960] mod_authz_core.c(809): [client x.x.x.x:59885] AH01626: authorization result of <RequireAny>: granted
[Sat Jul 13 19:57:46.059212 2019] [proxy:debug] [pid 32711:tid 140509913736960] mod_proxy.c(1107): [client x.x.x.x:59885] AH01142: Trying to run scheme_handler against proxy
[Sat Jul 13 19:57:46.059237 2019] [proxy:debug] [pid 32711:tid 140509913736960] proxy_util.c(2213): [client x.x.x.x:59885] AH00944: connecting http://google.com/ to google.com:80
[Sat Jul 13 19:57:46.059298 2019] [proxy:debug] [pid 32711:tid 140509913736960] proxy_util.c(2422): [client x.x.x.x:59885] AH00947: connected http://google.com/ to 127.0.0.1:16000

就像我说的那样,此设置过去可以正常工作。发生的唯一变化是我最近通过GCloud升级了服务器,以包括更多的RAM和CPU。

任何帮助都将不胜感激,因为我完全被这笑声浪费了

0 个答案:

没有答案