WLED-Native-Android icon indicating copy to clipboard operation
WLED-Native-Android copied to clipboard

Device discovered but control page is empty

Open eku opened this issue 9 months ago • 5 comments

Since I upgraded your App from from 4.x to 5.0.0 the control page for a device is empty.

Image Image

The mobile phone and the WLED device are in different networks. There's a squid proxy bridging HTTP requests between these networks.

I see network traffic logged

TCP_REFRESH_MODIFIED/200 1510 GET http://esp2.wlan.zx-spectrum/json/si - HIER_DIRECT/192.168.33.132 application/json

eku avatar Mar 26 '25 10:03 eku

Using a browser on the mobile phone the UI of WLED ist displayed, so the device can be reached and communicated with.

Image

eku avatar Mar 26 '25 10:03 eku

Thanks for the report, I will have to investigate!

I suspect it might be a security flag preventing the app from loading unsecured HTTP (not S) remotely (vs loading http from WLED devices locally).

Moustachauve avatar Mar 28 '25 05:03 Moustachauve

I suspect it might be a security flag preventing the app from loading unsecured HTTP (not S) remotely (vs loading http from WLED devices locally).

I'm running LOS21 based on AOSP14.

03-28 11:28:24.334  1369  2316 E serviceDiscovery: [MdnsMultinetworkSocketClient] ERROR Failed to send a mDNS packet.: sendto failed: EPERM (Operation not permitted)
03-28 11:28:24.334  1369  2316 E serviceDiscovery: java.io.IOException: sendto failed: EPERM (Operation not permitted)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:721)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at libcore.io.IoBridge.sendto(IoBridge.java:688)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:126)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at java.net.DatagramSocket.send(DatagramSocket.java:723)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.net.connectivity.com.android.server.connectivity.mdns.MdnsInterfaceSocket.send(MdnsInterfaceSocket.java:98)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.net.connectivity.com.android.server.connectivity.mdns.MdnsMultinetworkSocketClient.sendMdnsPacket(MdnsMultinetworkSocketClient.java:232)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.net.connectivity.com.android.server.connectivity.mdns.MdnsMultinetworkSocketClient.lambda$sendPacketRequestingUnicastResponse$1(MdnsMultinetworkSocketClient.java:283)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.net.connectivity.com.android.server.connectivity.mdns.MdnsMultinetworkSocketClient.$r8$lambda$Aeiw3e-ztWoU5cj2dQAw6RtchVE(MdnsMultinetworkSocketClient.java:0)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.net.connectivity.com.android.server.connectivity.mdns.MdnsMultinetworkSocketClient$$ExternalSyntheticLambda1.run(R8$$SyntheticClass:0)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.os.Handler.handleCallback(Handler.java:959)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.os.Handler.dispatchMessage(Handler.java:100)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.os.Looper.loopOnce(Looper.java:232)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.os.Looper.loop(Looper.java:317)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at android.os.HandlerThread.run(HandlerThread.java:68)
03-28 11:28:24.334  1369  2316 E serviceDiscovery: Caused by: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at libcore.io.Linux.sendtoBytes(Native Method)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at libcore.io.Linux.sendto(Linux.java:235)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at libcore.io.ForwardingOs.sendto(ForwardingOs.java:718)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:398)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      at libcore.io.IoBridge.sendto(IoBridge.java:686)
03-28 11:28:24.334  1369  2316 E serviceDiscovery:      ... 12 more
03-28 11:28:53.125 18939 18939 D ui.components.DeviceWebView: onPageStarted http://esp2.wlan.zx-spectrum/
03-28 11:28:53.126 18939 18939 I ui.components.DeviceWebView: doUpdateVisitedHistory http://esp2.wlan.zx-spectrum/, isReload: false
03-28 11:28:53.126 18939 18939 I ui.components.DeviceWebView: == Starting filter ========
03-28 11:28:53.126 18939 18939 I ui.components.DeviceWebView: Current Url: http://esp2.wlan.zx-spectrum/
03-28 11:28:53.126 18939 18939 I ui.components.DeviceWebView: 0
03-28 11:28:53.126 18939 18939 I ui.components.DeviceWebView: []
03-28 11:28:53.142 18939 18939 D ui.components.DeviceWebView: onPageFinished http://esp2.wlan.zx-spectrum/
...
03-28 11:28:54.288 18939 18986 I DeviceListDetailViewModel: Looping refreshes
03-28 11:28:54.288 18939 18986 I DeviceListDetailViewModel: Refreshing devices
03-28 11:28:54.290 18939 18986 D DeviceListDetailViewModel: devices found: 1
03-28 11:28:54.290 18939 18986 D DeviceListDetailViewModel: Refreshing device ESP2  Wohnzimmer - esp2.wlan.zx-spectrum
03-28 11:28:54.290 18939 18986 D RequestsManager: [ESP2  Wohnzimmer-esp2.wlan.zx-spectrum] Added new request: class H2.a (#1)
03-28 11:28:54.291 18939 18985 D RequestsManager: [ESP2  Wohnzimmer-esp2.wlan.zx-spectrum] Processing a request
03-28 11:28:54.387 18939 18985 D JsonApiRequestHandler: [esp2.wlan.zx-spectrum] Saving update of device from API
03-28 11:28:54.394 18939 18985 D RequestsManager: [ESP2  Wohnzimmer-esp2.wlan.zx-spectrum] Done request, can continue: true (0 left)
03-28 11:28:54.415 18939 18939 I ui.components.DeviceWebView: composing webview

I don't see any HTTP related exception in the ADB log.

Network sniffing shows the following communitcation

GET /json/si HTTP/1.1
If-Modified-Since: Fri, 28 Mar 2025 10:40:58 GMT
Host: esp2.wlan.zx-spectrum
Accept-Encoding: gzip
User-Agent: okhttp/5.0.0-alpha.14
Cache-Control: max-age=259200
Connection: keep-alive


HTTP/1.1 200 OK
Content-Length: 1191
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: *
Access-Control-Allow-Headers: *
Connection: close
Accept-Ranges: none

....

and

GET / HTTP/1.1
If-Modified-Since: Fri, 28 Mar 2025 10:34:30 GMT
Host: esp2.wlan.zx-spectrum
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Linux; Android 14; AC2003 Build/AP1A.240405.002.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.82 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
X-Requested-With: ca.cgagnier.wlednativeandroid
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
If-None-Match: 2502220-00-0000
Cache-Control: max-age=0
Connection: keep-alive


HTTP/1.1 304 Not Modified
Content-Length: 0
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: *
Access-Control-Allow-Headers: *
Connection: close
Cache-Control: no-cache
ETag: 2502220-00-0000
Accept-Ranges: none

Let me know if you need any further informations.

eku avatar Mar 28 '25 11:03 eku

Wow thank you, this is really useful!

I don't know if you are able to easily try, but could you try to add a device by ip address? To see if it's really related to the address or if it could be something else?

Thanks!

Moustachauve avatar Mar 28 '25 20:03 Moustachauve

I don't know if you are able to easily try, but could you try to add a device by ip address? To see if it's really related to the address or if it could be something else?

Does not make any difference.

I think the reason is that the proxy is answering all further requests with HTTP/304 and the app can't get around it.

The app should disable caching in the request header if it can't handle it itself. RFC 7234 may give you hints what to do.

eku avatar Mar 29 '25 10:03 eku