openhab-cloud
openhab-cloud copied to clipboard
504 Gateway Time-out on REST PUT
Summary: Attempting to use the paper-ui remotely through myopenhab to modify a few channels, and it appears that most of the paper-ui works fine, except for PUTs.
Tried issuing the same post through the REST docs ui, but end up with the same response.
The paper-ui works fine when locally, so this appears likely to be bug with the routing rules between the nginx accepting frontend and whatever service is relaying that post back to the local instance.
Sanitized Request headers:
PUT /rest/links/zwave_device_963cad32_node37_meter_watts/zwave:device:963cad32:node37:meter_watts HTTP/1.1
Host: home.myopenhab.org
Connection: keep-alive
Content-Length: 111
Authorization: Basic <redacted>
Accept: application/json, text/plain, */*
Origin: https://home.myopenhab.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
Content-Type: application/json;charset=UTF-8
Referer: https://home.myopenhab.org/paperui/index.html
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Cookie: <redacted>
Response:
HTTP/1.1 504 Gateway Time-out
Server: nginx/1.10.0 (Ubuntu)
Date: Thu, 19 Jan 2017 16:28:33 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 594
Connection: keep-alive
I have a similar problem. I use openhab cloud behind a apache reverse proxy and when I watch the Networkcomunication with the firefox Developementtools I see this returned by the proxy for the PUT requests.
Proxy Error
The proxy server received an invalid response from an upstream server. The proxy server could not handle the request PUT /rest/items/sss.
Reason: Error reading from remote server
Apache/2.4.18 (Ubuntu) Server at MyDomain.com Port 443
Yep same behaviour when I try and do a put for example change config of a binding ....
PUT /rest/services/org.openhab.openhabcloud/config HTTP/1.1
Host: home.myopenhab.org
Connection: keep-alive
Content-Length: 75
Pragma: no-cache
Cache-Control: no-cache
Accept: application/json, text/plain, */*
Origin: https://home.myopenhab.org
User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36
Content-Type: application/json
Referer: https://home.myopenhab.org/paperui/index.html
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-GB,en;q=0.8,de;q=0.6,fr;q=0.4,lb;q=0.2
Cookie: <obscured>
HTTP/1.1 504 Gateway Time-out
Server: nginx/1.10.0 (Ubuntu)
Date: Wed, 24 May 2017 06:16:54 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 594
Connection: keep-alive
This still doesnt work. Can someone tell us if this can get fixed, or even be reproduced by the devs?
Looks like the culprit is the bodyParser in app.js ~ line 207
207> app.use(bodyParser.json());
preassembleBody in routes/index.js is expecting events that are not firing, causing the timeout.
@petzlux,
I will take a look soon. Sorry was mad busy! Thanks for being patient
So just commenting that out only fixed the PUT and broke some other things. A workaround is to leave that line in app.js alone and to modify the /routes/index.js preassembleBody function. Prepend the following to the function body.
if (req._body) { req.rawBody=JSON.stringify(req.body); next(); return; }
A more long term solution would be to probably just use the bodyParser in its entirety and to remove preassembleBody altogether.
I also have the same issue, with RPI3 + clean openhabian. I basically can't do anything that requires saving (like changing configuration) through myopenhab. Directly through http://openhabianpi:8080 it works perfectly.
Isn't it happen to everyone? Looks kind of a big issue to me :S...
Same behaviour as @mahonni with RPI3 + clean openhabian. No further proxies. Cost me two hours today. :-(
I have the same problem on multiple openhab instances where i can't edit, add, or remove anything by using myopenhab.org. When trying to use the save button nothing happens for a while and then throws a 504 - gateway time-out. When connected locally to the openhab instance everything works perfect..
Any update on this issue?
Same issue here. I can confirm that @PaulBaugher 's fix does work if you run your own openHAB cloud instance as detailed here: https://community.openhab.org/t/setup-your-own-openhab-cloud-myopenhab-server-instance/24716
Hi, yes that seems like an issue at indexjs. I will go on this as next on my backlog. Sorry for the delay and thanks for your patience guys.
I will keep you updated for a fix.
This is fixed in #170 , but is not deployed. I think this weekend would be a good time to do so as I'm out of town until then.
Thanks, this fix was extremely necessary
Hi, if I'm not mistaken #170 is still not deployed to home.myopenhab.org. Could you please think about it? ;) Thanks ❤️