a proxy server code example

Example 1: apache reverse proxy

<VirtualHost *:80>
 ServerName domain.tld
 ServerAlias www.domain.tld
 ProxyRequests Off
 ProxyPass / http://123.456.7.89/
 ProxyPassReverse / http://123.456.7.89/
</VirtualHost>mixed

Example 2: apache reverse proxy

<IfModule mod_ssl.c>
<VirtualHost *:443 *:80>
        ServerAdmin [email protected]
        ServerName example.com

        SSLProxyEngine on
        ProxyPreserveHost On

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

        ProxyPass / http://127.0.0.1:5000/
        ProxyPassReverse / http://127.0.0.1:5000/

        ServerName example.com
        SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf

        ProxyRequests Off


</VirtualHost>
</IfModule>