Last active
November 26, 2023 21:29
-
-
Save gmag11/765af3682840512d8e03602614a7b24f to your computer and use it in GitHub Desktop.
NodeRed 1.0 reverse proxy configuration with Apache 2.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_ssl.c> | |
<VirtualHost _default_:443> | |
ServerName node.yourdomain.com | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/html # this does not matter | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
SSLEngine on | |
<FilesMatch "\.(cgi|shtml|phtml|php)$"> | |
SSLOptions +StdEnvVars | |
</FilesMatch> | |
<Directory /usr/lib/cgi-bin> | |
SSLOptions +StdEnvVars | |
</Directory> | |
SSLCertificateFile /etc/letsencrypt/live/node.yourdomain.com/fullchain.pem | |
SSLCertificateKeyFile /etc/letsencrypt/live/node.yourdomain.com/privkey.pem | |
Include /etc/letsencrypt/options-ssl-apache.conf | |
SSLProxyEngine On | |
SSLProtocol TLSv1.2 -TLSv1.1 | |
Define NodeRedURL "/nodered/" # Use your desired location | |
<Location ${NodeRedURL}> | |
RewriteEngine on | |
RewriteCond %{HTTP:Upgrade} ^WebSocket$ [NC] | |
RewriteCond %{HTTP:Connection} Upgrade$ [NC] | |
RewriteRule .*/(.*) "ws://localhost:1880/$1" [P,L] | |
ProxyPreserveHost On | |
ProxyRequests Off | |
ProxyPass http://localhost:1880/ | |
ProxyPassReverse http://localhost:1880/ | |
</Location> | |
</VirtualHost> | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing!
ProxyRequests Off
resulted inProxyRequests not allowed in <Location> context
; removing this line fixed it. Apache/2.4.56 on Debian Bullseye.