Apache2 reverse proxy to multiple docker-hosted sites (eg openhab)

Viewed 16

I have found a lot of information and help in this forum, but I could not find any solution for my proxy-problem.

I've been searching various forums and trying different options for the past few weeks, but my reverse proxy just isn't working.

I have apache2 running on Ubuntu 20.04 with several websites and also a few Docker containers in use.

Now I want to make a redirect via reverse proxy to 2 Docker websites to save me the SSL certificates.

Locally the Docker containers work

http://server1:1234 => Openhab Docker
http://server1:89 => Tasmota WebAdmin

The Apache-Conf currently looks like this

server-ssl.conf
# NameVirtualHost *:443
SSLStrictSNIVHostCheck Off

<VirtualHost *:443>
                ServerName server1.com
                ServerAlias *.server1.com
                ServerAdmin admin@server1.com
                <IfModule mod_headers.c>
                Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
                </IfModule>

                DocumentRoot /var/www/html
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                SSLEngine on
                RewriteEngine On
                SSLCertificateFile /etc/ssl/private/server1.crt
                SSLCertificateKeyFile /etc/ssl/private/server1.key
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                            SSLOptions +StdEnvVars
                </Directory>
                <Directory /var/www/html/>
                        DirectoryIndex index.htm index.html index.php
                        Options FollowSymLinks MultiViews
                        AllowOverride All
                        Order allow,deny
                        allow from all
                        Require all granted
                </Directory>
 
 ############################
 # Beginn Reverse Proxy Settings
 ###########################
 
 SSLProxyEngine On
 SSLProxyVerify none
 SSLProxyCheckPeerCN off
 SSLProxyCheckPeerName off
 SSLProxyCheckPeerExpire off

ProxyRequests Off
ProxyPreserveHost On

ProxyPass /openhab/ http://127.0.0.1:1234/
Header set Set-Cookie "X-OPENHAB-AUTH-HEADER=1"
ProxyPassReverse /openhab/ http://127.0.0.1:1234/

ProxyPass /tasmota/ http://127.0.0.1:89/
ProxyPassReverse /tasmota/ http://127.0.0.1:89/

####################
# Ende Reverse Proxy Settings
###################

The result of this config is

https://my.server1.com/openhab

I see the Title "Openhab" at the tab but no website, no openhab-Icons,... like at my Home-Net Perhaps because Openhab is using Java?

https://my.server1.com/tasmota

shows "URL not found" If I change it to

https://my.server1.com/tasmota/login

I see the login-page without formatting. After Login the URL changes to

https://my.server1.com/devices

but should be

https://my.server1.com/tasmota/devices

If I change it manually, I see my devices but without formatting.

I have no idea what is wrong, I thought it ist adding ProxyPass and ReverseProxyPass and the whole thing runs. Maybe someone has a tip for me?

Of course the modules proxy, proxy_http are running.

Thanks a lot and best regards

0 Answers
Related