1

我已经为 Datastax 编写的名为 OpsCenter 的 Cassandra 监控工具设置了一个基本代理。该应用程序是一个侦听 8888/8443 的 python 网络服务器。该应用程序不以 root 身份运行,因此无法在 80/443 上绑定,所以我想在前面运行 Apache 作为代理/反向代理。我遇到的问题是 OpsCenter 在每次请求后重写 URI,并写入端口。

例如https://mydomain.com/在每次请求后变为https://mydomain.com:8443/ 。这会阻止所有未来的请求工作,因为 8443 未在防火墙上打开。

当向客户端返回响应时,Apache 可以从 URI 中删除端口吗?

这是我的代理配置的样子。我正在代理处进行 SSL 终止。

ProxyRequests Off
ProxyPreserveHost On  # OpsCenter also rewrites the host, which becomes 127.0.0.1 without this.
SSLEngine On
SSLProxyEngine On
SSLCertificateFile "/path/to/cert"
SSLCertificateKeyFile "/path/to/key"
SSLProxyCheckPeerCN  Off
SSLProxyCheckPeerExpire Off


ProxyPass /tcp http://127.0.0.1:8888/tcp
ProxyPassReverse /tcp http://127.0.0.1:8888/tcp
ProxyPass /opscenter http://127.0.0.1:8888
ProxyPassReverse /opscenter http://127.0.0.1:8888
4

2 回答 2

1

如果您更改 opscenterd.conf,其中包位于 /etc/opscenter/opscenterd.conf,您可以设置列出的端口,因此它重写为

[webserver]
port = 8888
interface = 0.0.0.0

这将要求您绑定到的端口尚未被其他进程使用。

于 2013-12-19T23:02:34.430 回答
0
  • 你可以设置

    ProxyPreserveHost Off
    
  • 或者如果你想让它(像我一样):

    ProxyPreserveHost On
    

    那么你必须这样重写它:

    ProxyPass           /    http://127.0.0.1:8888/
    ProxyPassReverse    /    http://127.0.0.1:8888/
    ProxyPassReverse    /    http://example.com:8888/
    
于 2015-04-16T18:38:49.413 回答