I called it HTTPD and / or Apache2 because I have been using CentOS more lately and need to distinguish that for search engines.

To configure a reverse proxy in httpd you need the following code:

<VirtualHost *:80>
    ServerName api.somesite.com
    Redirect / https://api.somesite.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName api.somesite.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 / http://127.0.0.1:8000/
    ProxyPassReverse / http://127.0.0.1:8000/
</VirtualHost>

Afterwards you will most likely have to open a port in your firewall. To do this you have to do the following:

sudo firewall-cmd --zone=public --add-port=8000/tcp

Even after that you may run into the issue where SELinux is not allowing outside communication with that port. To allow bind with SELinux use the following command:

/usr/sbin/setsebool -P httpd_can_network_connect 1

While the above may not be a surgical fix for this problem, it does solve the problem right away. I have included it in my sources at the bottom in case I need to refer back to it.

Sources::

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.