Luup Request (data_request?id=lr_Foo) over remote access

MCV, I need your help with this one.

I’m making heavy use of the Luup Request callback mechanism (http://vera/port_3480/data_request?id=lr_Foo) in my plugins, calling them from JavaScript tabs to transfer sensitive information (security system PINs) straight from Lua to the user’s browser.

These work great over a LAN, and also over VPN.

Users are reporting that they don’t work over the MiOS remote access (https://fwdn.mios.com/remote/port_3480/data_request?id=lr_Foo). I got a user to run Firebug while using a JavaScript tab that makes such a call, and the call returned immediately without any JSON data inside.

Should Luup requests work over remote access? Is the URL above correct?

I can’t test this myself because I’m one of those unlucky users for whom JavaScript tabs don’t work over remote access, full stop.

The request is like this:
https://fwdn.mios.com///<Vera_Serial_No>/data_request?id=user_data

I tested it and it works. If the above URL is wrong, the received response is the empty body with the status 200 OK instead of the expected 404 Not Found.

I’ll try to find why your JavaScript tabs don’t work remotely and will give you an answer in the other thread.

Hi mcvflorin,

I’m aware of the URLs with the username/password/serialnumber sequence, but I don’t see how I can construct one of those with a relative path from the remote dashboard, where they’re not in the document URL anyway.

I’ve been putting the relative path “…/port_3480/data_request?id=lr_Foo” into the AJAX request. It works locally, but it seems that the relative layout isn’t the same for the case of lr_Foo requests.

Edit: in case it’s not obvious, the lr_ in this topic is important. I’m only experiencing problems with functions registetered via register_handler. I’ve got no issue with the user_data call.

I must confess I didn’t give any importance to what was after id, so your last edit helps. I don’t see any reason why the user_data request works and these not. Have you tried to use port_49451 instead? This is what I see on the Wiki for functions registered with luup.register_handler.

Oh, interesting. I noticed that in the Luup log the handler is being called. So I put some logging in.

function callbackHandler(lul_request, lul_parameters, lul_outputformat)
        debug("callbackHandler: request " .. lul_request)
        debug("callbackHandler: format " .. lul_outputformat)

Over remote I get this:

50	10/12/11 9:24:44.265	luup_log:93: callbackHandler: request GetConfiguration <0x4412>
50	10/12/11 9:24:44.266	luup_log:93: callbackHandler: format  <0x4412>

Over local I get this:

50	10/12/11 9:27:36.657	luup_log:93: callbackHandler: request GetConfiguration <0x4808>
50	10/12/11 9:27:36.658	luup_log:93: callbackHandler: format json <0x4808>

I’ve got output_format=json on both HTTP requests, but the remote forwarder is stripping it (even if I say output_format=xml, I get an empty string in my handler for lul_outputformat

I’ll modify my handler to treat an empty output format as JSON, which it wasn’t doing, until this bug in the forwarder gets fixed.

Port 3480 works, for the record.

Can you give me the url you are using over remote access servers (without authentication data of course)?

Un url like https://fwd2.mios.com/USER/PASS/SERIAL/data_request?id=user_data&output_format=xml works and format parameter is being passed over.

Well, no, I can’t for certain, because JavaScript tabs don’t work at all for me. But I am using my Firebug-fu to guess that they should look like this:
https://fwd1.mios.com/sid-12345678901234567890abcdefabcdef/port_3480/data_request?id=lr_GetConfiguration&data_format=json (and those are the URLs I was doing my testing with earlier in this topic).

The session ID is generated by cp.mios.com when I log into the cp.mios.com dashboard. Steps to reproduce:

  1. Visit https://cp.mios.com/.
  2. Log in.
  3. Switch to tab MiOS systems. URL is now something like: https://cp.mios.com/mysystems.php
  4. Click Dashboard. URL is now something like: https://fwd1.mios.com/remote/1.1.1245/?PK_AccessPoint=01234&sid=12345678901234567890abcdefacbdef
  5. Try to open a JavaScript tab for a device (on my Vera, if you are using the remote access I’ve authorized for user “web”, go to Global > Security System > Configuration).

I reiterate, at no time do any of the URLs look like https://fwd2.mios.com/USER/PASS/SERIAL/data_request?id=user_data&output_format=xml.

Edit: I’d be able to help you much more if you sorted out this other topic’s problem first. I don’t have a workaround for that one, but I do for the issue in this topic.