How to Use an Apache Reverse Proxy with Airlock
Running the Apache web server in front of Airlock can have a few benefits. You can use Apache's authentication mechanisms to have greater control over who can access Airlock's API, you can use SSL termination at Apache, use Apache's logs for access statistics, for example.
When terminating the SSL at Apache, make sure that the Apache reverse proxy and Airlock are running on the same host so unencrypted traffic is not being sent over the network. To install and configure Apache on CentOS, RHEL and Amazon Linux follow the steps below. First, install the Apache:
sudo yum install httpd
Create the Airlock configuration by creating a configuration file at /etc/httpd/conf.d/airlock.conf
:
<VirtualHost *:80>
ProxyPreserveHost On
ServerName airlock.mydomain.com
LogLevel warn
ErrorLog logs/airlock.mydomain.com-error_log
CustomLog logs/airlock.mydomain.com-access_log combined
<Location />
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</Location>
</VirtualHost>
Start Apache:
sudo systemctl start httpd
Make sure it started successfully:
sudo systemctl status httpd
Set the Apache service to start automatically:
sudo systemctl enable httpd
Verify you can access Airlock through the reverse proxy:
curl http://airlock.mydomain.com/api/status