Fehlermeldungen bei FTUI via Apache mit PHP

Begonnen von aHome77, 27 Januar 2019, 13:34:36

Vorheriges Thema - Nächstes Thema

aHome77

Hallo Zusammen,

ich habe das FHEM-Tablet-UI über den Apache am Start, leider scheinen die FHEM devices nicht erreichbar zu sein. An was könnte dies liegen?


In der Konsolen Ansicht von Firefox sehen ich div. Fehlermeldungen:
Zitatwebsockets URL=ws://192.168.2.19/fhem?XHR=1&inform=type=status;filter=undefined;since=1548579168575;fmt=JSON&timestamp=1548579168579 fhem-tablet-ui.js:2104:13
Firefox kann keine Verbindung zu dem Server unter ws://192.168.2.19/fhem?XHR=1&inform=type=status;filter=undefined;since=1548579168575;fmt=JSON&timestamp=1548579168579 aufbauen. fhem-tablet-ui.js:1177:39
Error while longpoll: undefined fhem-tablet-ui.js:2104:13
websocket (url=ws://192.168.2.19/fhem?XHR=1&inform=type=status;filter=undefined;since=1548579168575;fmt=JSON&timestamp=1548579168579) closed!  reason=The connection was closed abnormally, e.g., without sending or receiving a Close control frame fhem-tablet-ui.js:2104:13
restartLongpoll fhem-tablet-ui.js:2104:13
stopLongpoll fhem-tablet-ui.js:2104:13
stopped websocket fhem-tablet-ui.js:2104:13
startLongpoll: true fhem-tablet-ui.js:2104:13
websockets URL=ws://192.168.2.19/fhem?XHR=1&inform=type=status;filter=undefined;since=1548579178623;fmt=JSON&timestamp=1548579178625 fhem-tablet-ui.js:2104:13
Firefox kann keine Verbindung zu dem Server unter ws://192.168.2.19/fhem?XHR=1&inform=type=status;filter=undefined;since=1548579178623;fmt=JSON&timestamp=1548579178625 aufbauen.

phil82

Hallo aHome,

vermutlich ist der Reverse Proxy vom Apache nicht korrekt konfiguriert. Poste mal deine Apache-Konfiguration.
Bei mir sieht das wie folgt aus:
        <Location /fhem>

                #Für Logpoll = Websocket die Aufrufe umleiten
                #Wichtig: hierfür muss das Apache-Modul proxy_wstunnel geladen sein
                RewriteEngine On
                RewriteCond %{HTTP:Upgrade} =websocket [NC]
                RewriteRule /fhem(.*)           ws://localhost:8083/fhem$1 [P,L]
                RewriteCond %{HTTP:Upgrade} !=websocket [NC]
                RewriteRule /fhem(.*)           http://localhost:8083/fhem$1 [P,L]


                # ProxyPass/ProxyPassReverse leitet HTTP requests auf eine andere URL um
                ProxyPass http://localhost:8083/fhem
                ProxyPassReverse http://localhost:8083/fhem
                ProxyHTMLEnable On

                # ProxyHTMLURLMap passt Links im HTML/JavaScript Source an
                ProxyHTMLURLMap /        /fhem/
                ProxyHTMLURLMap /fhem/     /fhem/

                SetOutputFilter INFLATE;proxy-html;DEFLATE
        </Location>

Nicht vergessen: Apache-Modul proxy_wstunnel laden.
Bei mir sind auch die Module proxy, proxy_html und proxy_http aktiv. Aber wenn ein Modul fehlt, dann wird Apache schon meckern.

Auf welchem Port läuft Apache? und auf welchem Port Fhem? SSL im Einsatz? Welches Betriebssystem? Welche Apache-Version? Firewall aktiv?
Ansonsten erstmal ohne PHP, ohne SSL, ohne Firewall, etc. ausprobieren und eine einfache TabletUI-Konfiguration nehmen.
(Sieht mir aber nicht nach einem PHP-Problem aus)

Bei mir habe ich Apache2-irgendwas mit SSL und PHP im Einsatz - grundsätzlich funktioniert das.

Gruß
Philipp

aHome77

Apache 2.4

In der apache2.conf steht:

<Directory /opt/fhem/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>


in der fhem.conf:

<IfModule mod_proxy.c>


  <Location /fhem>
                #Für Logpoll = Websocket die Aufrufe umleiten
                RewriteEngine On
                RewriteCond %{HTTP:Upgrade} =websocket [NC]
                RewriteRule /fhem(.*)           ws://localhost:8083/fhem$1 [P,L]
                RewriteCond %{HTTP:Upgrade} !=websocket [NC]
                RewriteRule /fhem(.*)           http://localhost:8083/fhem$1 [P,L]

                # ProxyPass/ProxyPassReverse leitet HTTP requests auf eine andere URL um
                ProxyPass http://localhost:8083/fhem
                ProxyPassReverse http://localhost:8083/fhem
                ProxyHTMLEnable On
                SetOutputFilter INFLATE;proxy-html;DEFLATE

                # ProxyHTMLURLMap passt Links im HTML/JavaScript Source an
                # ProxyHTMLURLMap /        /fhem/
                # ProxyHTMLURLMap /fhem/     /fhem/

   </Location>

</IfModule>


In der 000-deflault.conf hatte ich das vor 2 Jahren eingetragen

<VirtualHost *:80>


DocumentRoot /opt/fhem/www/tablet
    #DocumentRoot /opt/fhem/www

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On


    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    #<Directory /opt/fhem/www>
<Directory /opt/fhem/www/tablet>
        Options Indexes FollowSymLinks MultiViews Includes
        AllowOverride None
        Order allow,deny
        allow from all
        XBitHack on
#Require all granted
   
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST

#<Files "index.php">
    #    <LimitExcept POST>
    #        Require all denied
    #    </LimitExcept>
    #</Files>
   
</Directory>



    # Erspart uns das Umbenennen von Links
    # Alias /fhem /opt/fhem/www

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

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


Evtl. "beißt" sich das ein oder andere

grüße

Andi

aHome77

Wenn ich dies aktiviere, dann wird die Schrift in der Standard Fhem Weboberfläche "fett", also verändert sich.

ProxyHTMLEnable On
SetOutputFilter INFLATE;proxy-html;DEFLATE

phil82

Zitat von: aHome77 am 09 Februar 2019, 15:25:27
Evtl. "beißt" sich das ein oder andere

Ja, irgendwie glaube ich das auch. Ich bin jetzt nicht so wirklich hinter deine Konfiguration durchgestiegen und nicht alle Anweisungen sagen mir was - bin halt keine Apache-Profi.
Warum verteilst du die Konfigurtation von der gleichen Web-Seite auf mehrere Konfigurationen? Ich bin mir nicht sicher, ob die Konfigurationen der einen Datein in der anderen "gelten".

Ich denke, dass du dieses "ProxyHTMLURLMap" einkommentieren musst. Was "ProxyVia Off" und "ProxyPreserveHost On" machen weißt ich nicht, daher erstmal raus damit. Gleiches gilt für "XBitHack on" und "RewriteEngine On" mit "RewriteCond %{REQUEST_METHOD} POST" aus der "000-deflault.conf"

Außerdem gehe ich davon aus, dass das Modul "mod_proxy" auch geladen ist? Sonst passt in der  fhem.conf.

Ansonsten weiß ich auch nicht.
Gruß
Philipp