大网数据广告活动
服务器运维问答

HTTPS proxy in apache for rest API

· 52CE 我爱测

Sounds like a basic question, but I don't know about apache config. Any help would be great. Since Open TSDB wont support https to send data(via REST API), we want to create a https proxy in apache or "Apache Tomcat". For example…

问题原文

原帖链接 · Veerendra K · CC BY-SA 3.0

Sounds like a basic question, but I don't know about apache config. Any help would be great.

Since Open TSDB wont support https to send data(via REST API), we want to create a https proxy in apache or "Apache Tomcat". For example, the local machine has both TSDB and Apahce. The apache should accept http and https, if I send any to https://<PUBLIC IP>/api/input, it should forward to TSDB in that same machine (Or TSDB could be in different machine) with http.

The big picture

MY Code<---->https://<PUBLIC IP>/api/input<----Proxy to---->http://localhost/api/input

Above I mentioned Apache Tomcat because, mainly we are using Apache Tomcat for other purpose so, first priority is Tomcat(Is it possible with Tomcat?).

NOTE: I know the difference between Apache and Apache Tomcat: Apache is http web server handles the http traffic only, tomcat is servelet container to process the request(For Java only). In build Tomcat has Apache.(Please correct me, if I am wrong)

已采纳解答

原帖链接 · Daniel Ferradal · CC BY-SA 3.0

In Apache HTTPD basically it would be like this:

<VirtualHost *:80>
ServerName publicname.example.com
Redirect / https://publicname.example.com/
</VirtualHost>

<VirtualHost *:443>
ServerName publicname.example.com
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/key.pem
ErrorLog /path/to/logs/publicaname.example.com-ssl-error.log
CustomLog /path/to/logs/publicaname.example.com-ssl.log combined

ProxyPass /api/input http://127.0.0.1:8080/api/input
ProxyPassReverse /api/input http://127.0.0.1:8080/api/input
</VirtualHost>

Note: you will need mod_proxy and mod_proxy_http modules loaded first.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。