反向代理 - 错误网关

反向代理 - 错误网关

由于某些原因我需要访问https://api.postcodeapi.nu/使用 http 而不是 https。我在我的 Apache 中创建了一个反向代理:

<VirtualHost 127.0.0.1:80>
ServerName api.postcodeapi.nu.local
SSLProxyEngine on
ProxyPass / https://api.postcodeapi.nu/
ProxyPassReverse / https://api.postcodeapi.nu/
</VirtualHost>

在 /etc/hosts 中添加以下行

127.0.0.1      api.postcodeapi.nu.local

并使用 curl 进行访问但出现 Bad gateway:

# curl http://api.postcodeapi.nu.local
<!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>

有人可以帮帮我吗?

相关内容