Apache Proxy HTTP and WebSocket with SSL certificate(Self-signed)

<IfModule mod_ssl.c>
        <VirtualHost *:443>
                ServerAdmin webmaster@localhost
                ServerName api.example.com
                ServerAlias api-dev.example.com api-prd.example.com

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

                SSLEngine on
                SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
                SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

                ProxyPass / http://localhost:8443/
                RewriteEngine on
                RewriteCond %{HTTP:Upgrade} websocket [NC]
                RewriteCond %{HTTP:Connection} upgrade [NC]
                RewriteRule ^/?(.*) "ws://localhost:8443/$1" [P,L]
        </VirtualHost>
</IfModule>

mod_proxy_wstunnel 모듈 활성화 필요

Leave a comment

Your email address will not be published.