New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong URL Provided in rest/sitemaps/events/subscribe behind a reverse proxy #442
Comments
Isn't that Eclipse SmatHome specific instead of a openHab distribution one?
Am 31.03.2017 8:46 nachm. schrieb "Brett Jenkins" <notifications@github.com
…:
Hi,
I've got an issue where a call to /rest/sitemaps/events/subscribe
responds with
{"status":"CREATED","context":{"headers":{"Location":["http:
//machineip:8080/rest/sitemaps/events/2cd43474-995f-4f14-bb9f-2ff04911fcdb
"]},"committingOutputStream":{"bufferSize":0,"directWrite":
true,"isCommitted":false,"isClosed":false},"entityAnnotations":[],"
entityStream":{"bufferSize":0,"directWrite":true,"
isCommitted":false,"isClosed":false}}}
Which breaks my event streaming. Everything else on the page is working
fine however, it's just the response from this URL. Can this be changed to
be relative - or alternatively give us the option to override it through a
setting?
Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#442>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMffktEP9NW9StzFprd-0JGmcKTFeuHks5rrUoDgaJpZM4MwBW->
.
|
I have what I believe to be a related problem. When running behind a reverse proxy, BasicUI page displays and controls all just fine, but the bottom of the page always displays "Offline: waiting for connection to become available". I'm not familiar with the internals of OpenHAB/Eclipse, but it looks like this is a event messaging issue like the OP. |
I agree, it should be a relative path. I can change that. |
+1 |
I have a doubt because absolute URLs are used in all the sitemap REST API. Why should it be a relative path only for one particular API ? @brettyj : can you check using REST documentation UI what URLs you get in the result when using GET /sitemaps and GET /sitemaps/<sitemap_name> ? |
The URL is generated in the basicui. It's not a problem of the rest addon. |
Basic UI is just using the URL returned by the subscription request. Basic UI is just concatenating the arguments like sitemap and page id. |
I've found a workaround as long as you aren't manipulating paths (need to serve openhab from /) If you set the Host header to the host the client requested, the basic UI will use that as the prefix. [1][2] e.g. (Nginx)
NOTE: The scheme will also have to match for this to construct compatible urls. (If your external service is https, be sure you're talking to openhab internally over https.) [1] https://github.com/eclipse/smarthome/blob/master/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResource.java#L116 |
After applying above workaround, the uis keeps in sync when I toggle switches on my phone and laptop. |
A POST request on https://full-domain/rest/sitemaps/events/subscribe Here the IP 10.1.3.2 is from the running docker container and not from the host with the reverse proxy. |
If $host isn't the right value in your setup, you could try hardcoding it to the external dns name. |
@brosander I use a haproxy and not the nginx here. The host header is correctly set in the request header. |
I'm using OpenHAB behind an IIS reverse proxy (IIS providing AUTH). I'm getting the same results as @dhde . Using my external host name in the request: https://www.MY-DOMAIN.com:444/rest/sitemaps/ I get the OpenHAB ip/port in the return JSON. [{"name":"home","label":"OmniPro Control","link":"http://192.168.1.25:8080/rest/sitemaps/home","homepage":{"link":"http://192.168.1.25:8080/rest/sitemaps/home/home","leaf":false,"widgets":[]}},{"name":"_default","label":"Home","link":"http://192.168.1.25:8080/rest/sitemaps/_default","homepage":{"link":"http://192.168.1.25:8080/rest/sitemaps/_default/_default","leaf":false,"widgets":[]}}] I know this can be rewritten in IIS, I just need to figure out how now. |
Looks like I need to find another solution. Seems that IIS only rewrites the ip/port in the headers and within specified tags (form, frame, img, etc.). It does not appear that you can rewrite ip/port that is embedded in the result data like the returned JSON. Is there a setting in OpenHAB that lets me set a host name globally? |
it seems a problem in the problem must be here: same problem with some sugestion here: |
In the haproxy seems a wrong X-Forwarded-For header is set. |
If anyone comes here looking to work around this issue and is using an Apache2 Reverse Proxy Server, this Tutorial I found (but did not write) helped me. |
Hi,
I've got an issue where a call to http://reverseproxy.proxy.com/rest/sitemaps/events/subscribe responds with
{"status":"CREATED","context":{"headers":{"Location":["http://machineip:8080/rest/sitemaps/events/2cd43474-995f-4f14-bb9f-2ff04911fcdb"]},"committingOutputStream":{"bufferSize":0,"directWrite":true,"isCommitted":false,"isClosed":false},"entityAnnotations":[],"entityStream":{"bufferSize":0,"directWrite":true,"isCommitted":false,"isClosed":false}}}
Which breaks my event streaming. Everything else on the page is working fine however, it's just the response from this URL. Can this be changed to be relative - or alternatively give us the option to override it through a setting?
Thanks
The text was updated successfully, but these errors were encountered: