![反向代理 - 错误网关](https://linux22.com/image/722251/%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%20-%20%E9%94%99%E8%AF%AF%E7%BD%91%E5%85%B3.png)
由于某些原因我需要访问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>
有人可以帮帮我吗?