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)
In Apache HTTPD basically it would be like this:
Note: you will need mod_proxy and mod_proxy_http modules loaded first.
Thanks to @ezra-s, I'm able to send data. But while doing, I struggled little bit,so I just want to share some info.
1.
sudo apt-get install -y libapache2-mod-proxy-html libxml2-dev apache2-prefork-dev libxml2-dev
2.Enabling modules
sudo a2enmod proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_htm ssl
3.Generated self signed certificate here is the guide
4.Added config to
/etc/apache2/sites-enabled/000-default.conf
5.I tried to restart
sudo service apache2 restart
. But I got errorAfter a long Internet search I found mod_xml2enc not available bug. So, I built this module from source
Thanks for the help!
There are many ways how to achieve the result you want.
Make your Tomcat listen on 127.0.0.1:8080 and set-up some front-end server before it. Your front-end server will listen on *:80 and *:443 and forward all requests to the hidden Tomcat.
There are many front-end servers. It can be Apache (as you offered), nginx (which eats less memory) or haproxy (which offers great statistics together with almost constant memory footprint).
One possible configuration snippet for nginx can be:
For generation TLS configuration I recommend Mozilla SSL configuration generator