ady624 / webCoRE

webCoRE is a web version of CoRE
GNU General Public License v3.0
251 stars 984 forks source link

local hostname blacklisted? #107

Closed chrwei closed 4 years ago

chrwei commented 4 years ago

when I used a webrequest with the local IP it works, but a local hostname says it's blacklisted. from searches I'm guessing this has to do with some logic on whether the request should be done local or proxied via ST servers.

this works +129ms | ║║Sending internal web request to: 192.168.11.69:3000/assistant +134ms | ║║Executed virtual command httpRequest (26ms) +136ms | ║║Requesting a wake up for Sat, Jun 6 2020 @ 12:05:35 PM CDT (in 20.0s) +151ms | ║╚Execution stage complete. (54ms)

this fails +105ms ║║Sending external web request to: pine64.fortress.lan:3000/assistant
+157ms ║║Error executing external web request: java.lang.SecurityException: Endpoint http://pine64:3000/assistant is blacklisted.
+159ms ║║Executed virtual command httpRequest (73ms)

the short hostname does work on my android phone and other devices since i have local DNS and search domains configured properly. any chance "no dots in hostname" can be treated as local or is this an ST limitation that won't work anyway?

chrwei commented 4 years ago

did some tests, go it to request local, but it didn't work, maybe local doesn't do any DNS lookups?.

guess this is a limitation we have to live with. would be nice if it were more specifically documented though.

idpaterson commented 4 years ago

Correct, webCoRE uses the host name to guess whether to issue a local or remote request. Only requests to localhost or a local network IP range are handled by the hub. Remote requests are done on the ST platform rather than the hub so are not subject to your local DNS setup.

idpaterson commented 4 years ago

Checking for no dots seems reasonable, feel free to submit a pull request to add that to the webCoRE piston groovy smart app. You can probably grep for 127 or 192 to find where the local IP ranges are tested.

chrwei commented 4 years ago

I already tested it and still doesn't work, several seconds later a [] result appears. I also tried the full local hostname and that didn't work either. the other option would be to try to do a hostname lookup and compare the IP, but if hostname didn't work I suspect that's a dead end too.