My first post here. I searched the forum and couldn’t find the answer, so posting this in a new thread.
I am trying to set up a reverse proxy for OH2 using Apache 2.4 server on my Win7 PC. I found this tutorial which is written for NGINX server, but couldn’t find anything similar for Apache.
This is what I have now (see below). It works partially - I can access the top level page of OH2 using address my_domain/openhab , and also I can enter the Basic UI page and see the top level groups listed. But when I click on a group (which contains one Switch and one Number items), OH keeps showing the running line at the top and never shows the items.
So basically addresses like xxx:8080/basicui/app get translated to yyy/openhab/basicui/app without issues, but for the address xxx:8080/basicui/app?w=0000&sitemap=demo the translation doesn’t work.
Here is my Apache’s virtual host code:
<VirtualHost _default_:443>
ServerAdmin admin@commaster.net
ServerName xxxx
RewriteEngine On
RewriteCond %{HTTP_HOST} !^xxxx$ [NC]
RewriteRule ^/?(.*)$ https://xxxx/$1 [NE,L,R=301]
SSLEngine on
SSLCertificateFile "C:/Users/**.pem"
SSLCertificateKeyFile "C:/Users/**.pem"
SSLCertificateChainFile "C:/Users/*.pem"
<Location "/openhab">
AuthType Basic
AuthName "private"
AuthUserFile "c:\Apache24\***"
Require valid-user
ProxyPass "http://localhost:8080"
ProxyPassReverse "http://localhost:8080"
</Location>
</VirtualHost>
I am sure I am doing something wrong, just can’t figure out what exactly. My suspicion is that my code doesn’t have something equivalent to the four “proxy_set_header” lines in the tutorial, as I don’t know how to implement that in Apache. Can anyone please give me a hand here?
EDIT: Looking at Apache logs, it looks like initially the links are translated properly (have /openhab at the beginning), but one POST and one GET at the end do not start with /openhab, so not surprisingly I get 404 code for them:
"GET /openhab/basicui/smarthome.js HTTP/1.1" 304 -
"GET /openhab/basicui/mdl/material.min.js HTTP/1.1" 304 -
"GET /openhab/basicui/favicon.ico HTTP/1.1" 304 -
"POST /rest/sitemaps/events/subscribe HTTP/1.1" 404 228
"GET /openhab/icon/3d_printer?state=UNDEF&format=png HTTP/1.1" 200 17385
"GET /basicui/app?w=0000&sitemap=demo&subscriptionId=undefined&__async=true HTTP/1.1" 404 209
It looks like when a query is present in the path, translation is broken.