FHEM-Backend sperren - nur Zugriff per TabletUI ?

Begonnen von ToM_ToM, 02 März 2018, 15:33:22

Vorheriges Thema - Nächstes Thema

ToM_ToM

#60
Ich habe es jetzt geschafft dass wenn man nur die IP eingibt, auch automatisch auf FTUI weitergeleitet wird.
Nur bei Falscheingaben (Pfade die nicht existieren), landet man nun noch aufs FHEM-Backend. Das habe ich aber wie du gesagt hast, soweit nackig gemacht dass dort nur noch eine leere Seite kommt.

Aber das mit den fehlerhaften Umlauten, Gradzeichen usw. treibt mich noch in den Wahnsinn.
Kann man irgendwie prüfen was tatsächlich für ein Zeichensatz im Browser ankommt?

Auch die Meta-Angaben helfen nichts. Habe es mit <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
als auch mit <meta charset="UTF-8"> in der index.html probiert.

In der Apache Config habe ich auch AddCharset UTF-8 .utf8 und ProxyHTMLCharsetOut UTF-8 getestet, aber bringt leider auch nichts.


<VirtualHost *:80>
ServerName tablet.bananapi.local
ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html

DocumentRoot /var/www

Header set Access-Control-Allow-Origin "*"

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

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On

#ProxyHTMLCharsetOut UTF-8
#ProxyHTMLMeta ON


RewriteEngine           On
RewriteOptions          InheritDownBefore

#Aufruf von http://IP-ADDRESS umleiten auf http://IP-ADDRESS/frontend/tablet_pagebutton_modern/index.html
RewriteRule             ^/$   %{REQUEST_SCHEME}://%{HTTP_HOST}/frontend/tablet_pagebutton_modern/index.html  [redirect]

#Aufruf von http://IP-ADDRESSE/frontend umleiten auf http://IP-ADDRESS/tablet_pagebutton_modern/frontend/index.html
RewriteRule             ^/frontend$   %{REQUEST_SCHEME}://%{HTTP_HOST}/frontend/tablet_pagebutton_modern/index.html  [redirect]


<Location /frontend>

#AddCharset UTF-8 .utf8

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

# Websockets
ProxyPass ws://localhost/fhem
ProxyPassReverse ws://localhost/fhem

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


SetOutputFilter INFLATE;proxy-html;DEFLATE



</Location>


<Location /fhem>

#AddCharset UTF-8 .utf8

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

  # Websockets
  ProxyPass ws://localhost:8085/fhem
  ProxyPassReverse ws://localhost:8085/fhem

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

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


        #AuthType Basic
        #AuthName "Password Required"
        #AuthUserFile /var/www/basicAuth.htpasswd
        #Require valid-user
#Order allow,deny
#Allow from all

SetOutputFilter INFLATE;proxy-html;DEFLATE

</Location>




</VirtualHost>

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


Hardware: BananaPi, Busmaster CUL, SanDisk 16GB Ultra SD, 16 GB USB-Stick | Software: Armbian, FHEM 5.8

ToM_ToM

Ich habe es endlich hinbekommen.

Schuld war die Kombination aus
SetOutputFilter INFLATE;proxy-html;DEFLATE
und
ProxyHTMLEnable On

Mit folgender Config läuft es jetzt.


<VirtualHost *:80>
ServerName $HOST
ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html

DocumentRoot /var/www

Header set Access-Control-Allow-Origin "*"

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

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On

#ProxyHTMLCharsetOut UTF-8
#ProxyHTMLMeta ON

CharsetSourceEnc UTF-8
#CharsetDefault ISO-8859-1
#AddDefaultCharset UTF-8

RewriteEngine           On
RewriteOptions          InheritDownBefore

#Aufruf von http://IP-ADDRESS umleiten auf http://IP-ADDRESS/frontend/tablet_pagebutton_modern/index.html
RewriteRule             ^/$   %{REQUEST_SCHEME}://%{HTTP_HOST}/frontend/tablet_pagebutton_modern/index.html  [redirect]

#Aufruf von http://IP-ADDRESSE/frontend umleiten auf http://IP-ADDRESS/tablet_pagebutton_modern/frontend/index.html
RewriteRule             ^/frontend$   %{REQUEST_SCHEME}://%{HTTP_HOST}/frontend/tablet_pagebutton_modern/index.html  [redirect]


<Location /frontend>

#AddCharset UTF-8 .utf8

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

# Websockets
ProxyPass ws://localhost/fhem
ProxyPassReverse ws://localhost/fhem

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


#SetOutputFilter INFLATE;proxy-html;DEFLATE



</Location>


<Location /fhem>

#AddCharset UTF-8 .utf8

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

  # Websockets
  ProxyPass ws://localhost:8085/fhem
  ProxyPassReverse ws://localhost:8085/fhem

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

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


        #AuthType Basic
        #AuthName "Password Required"
        #AuthUserFile /var/www/basicAuth.htpasswd
        #Require valid-user
#Order allow,deny
#Allow from all

#SetOutputFilter INFLATE;proxy-html;DEFLATE

</Location>




</VirtualHost>

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


Hardware: BananaPi, Busmaster CUL, SanDisk 16GB Ultra SD, 16 GB USB-Stick | Software: Armbian, FHEM 5.8

CoolTux

Ohne Scheiß. Ich bin wahnsinnig stolz auf Dich und freu mich das Du es geschafft hast.

8)  8)
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

ToM_ToM

ZitatOhne Scheiß. Ich bin wahnsinnig stolz auf Dich und freu mich das Du es geschafft hast.

Haha. Danke. Aber ich freue mich noch viel mehr. Hätte nicht gedacht dass das so eine schwierige Geburt wird. Aber so ist es ja meistens in der Programmierung. Die Dinge die man sich einfach vorstellt, kosten am Ende am meisten Nerven.

Vielen vielen Dank nochmal für deine Unterstützung. :)
Hardware: BananaPi, Busmaster CUL, SanDisk 16GB Ultra SD, 16 GB USB-Stick | Software: Armbian, FHEM 5.8

RaspiLED

[emoji1303][emoji123][emoji6]


Raspi2 mit FHEM, CUL, Signalduino, MySensors, HomeBridge, Presence, Bravia, ...
Raspberry Pi mit FHEM, CUL, Signalduino, MySensors, HomeBridge, Presence, WifiLight2, Bravia, ...

CoolTux

Zitat von: ToM_ToM am 14 Juli 2018, 21:56:47
Haha. Danke. Aber ich freue mich noch viel mehr. Hätte nicht gedacht dass das so eine schwierige Geburt wird. Aber so ist es ja meistens in der Programmierung. Die Dinge die man sich einfach vorstellt, kosten am Ende am meisten Nerven.

Vielen vielen Dank nochmal für deine Unterstützung. :)

Gerne. Aber so viel war das ja nicht. Eher so Händchen halten  :), der größte Dank gebührt Dir selbst. Darauf eine kühle 👱
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

ToM_ToM

Irgendwie habe ich mich zu früh gefreut...  :(

Meine Hauptseite läuft zwar super, aber eine andere Seite bekomme ich nicht zum laufen. 2 Seiten konnte ich durch "Convert to UTF-8" im Notepad++ zum laufen bekommen, aber bei der einen funktioniert dieser Trick leider nicht. Irgendwas läuft über den Proxy mit dem Charset Encoding nicht sauber.
Das kostet mich wohl noch einiges Zeit und Nerven.
Hardware: BananaPi, Busmaster CUL, SanDisk 16GB Ultra SD, 16 GB USB-Stick | Software: Armbian, FHEM 5.8