Last active
January 24, 2022 09:56
-
-
Save vbalexr/bd3fa88ce4e7f9165da038e74673b1f6 to your computer and use it in GitHub Desktop.
Apache proxy ssl thingsboard
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
<VirtualHost *:443> | |
ServerAdmin "EMAIL ADMIN" | |
DocumentRoot /var/www/html | |
ServerName "SERVERNAME" | |
ProxyRequests off | |
ProxyPreserveHost On | |
#Redireccion de wss a ws | |
RewriteEngine on | |
RewriteCond %{HTTP:Upgrade} websocket [NC] | |
RewriteCond %{HTTP:Connection} upgrade [NC] | |
RewriteRule .* "ws://localhost:9201%{REQUEST_URI}" [P] | |
#Redireccion de https(443) a 8080 mostrar maintenace.html en caso de error | |
ProxyPass /maintenance.html ! | |
ProxyPass / http://localhost:8080/ | |
ProxyPassReverse / http://localhost:8080/ | |
#Archivos de bitacora | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
#Configuracion de SSL | |
SSLEngine on | |
SSLCertificateFile "CERTFILE" | |
SSLCertificateKeyFile "KEYFILE" | |
</VirtualHost> |
Thanks it helps me too!
Very useful to put Thingsboard behind a proxy with https/ssl connection.
I appended this to my 000-default-le-ssl.conf , after Certbot section:
ProxyRequests Off
ProxyPreserveHost On
# wss -> ws redirect
RewriteEngine on
RewriteCond "%{HTTP:Upgrade}" "websocket" [NC]
RewriteCond "%{HTTP:Connection}" "upgrade" [NC]
RewriteRule "^/?(.*)" "ws://localhost:8080/$1" [P,L]
# https -> http(8080) redirect
ProxyPass "/" "http://localhost:8080/"
ProxyPassReverse "/" "http://localhost:8080/"
Many many thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thx. I lost all day with it.