通过Apache设置从https到http的基本代理

我需要代理一些远程API https://example.com/api/

可以在本地访问http://localhost/api/

我试图把这一行放在httpd.conf

  ProxyPass /api/ https://example.com/api/ 

我已经检查了这些模块是否启用:

  ssl_module, proxy_module, proxy_http_module 

当我试图达到http://localhost/api/ ,我得到500内部服务器错误,而我在error_log看到的是:

 [Wed Jan 14 16:42:04.788401 2015] [proxy:warn] [pid 21916] [client ::1:59260] AH01144: No protocol handler was valid for the URL /api/v1/ads. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. 

我的问题是相对于这个: https : //stackoverflow.com/questions/1997001/setting-up-a-basic-web-proxy-in-apache 。 其实,当我尝试代理http资源时,一切都适合我,所以问题出在SSL的某处。

我想要这个工作的原因是我在本地处理远程API时遇到的Access-Control-Allow-Origin问题。


UPDATE

这是整个conf文件。 https://www.dropbox.com/s/mkrxna4h2o9yu8k/httpd.conf?dl=0

这应该是你需要的一切:

 RewriteEngine On RewriteRule ^/api/(.*)$ https://example.com/api/$1 [P,QSA,L] 

Apache将基本上通过默认启用的mod_rewrite模块创build新的http请求来代理您的请求