CookCLI
CookCLI copied to clipboard
Unable to access cook server via LAN
It doesn't have the output like the help page.
Access on another Android device:
~ $ curl -vvl http://192.168.1.10:9080/
* Trying 192.168.1.10:9080...
* connect to 192.168.1.10 port 9080 failed: Connection refused
* Failed to connect to 192.168.1.10 port 9080 after 6 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to 192.168.1.10 port 9080 after 6 ms: Couldn't connect to server
~ $ nmap -P0 -sV -p9080 192.168.1.10
Starting Nmap 7.94 ( https://nmap.org/ ) at 2023-11-25 12:20 CST
Nmap scan report for 192.168.1.10
Host is up (0.0048s latency).
PORT STATE SERVICE VERSION
9080/tcp closed glrpc
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 0.80 seconds
~ $
Chrome prompts ERR_CONNECTION_REFUSED
.
@2096779623 could you please check if it helps to start the server with --host
option? Like cook server --host
. Thanks!
Works, but it looks a bit weird and the recipes don't display properly after adding the --host
parameter.
Thanks for checking. Yeah, that doesn't look great... It suspiciously look like a CORS issue. I'll have a look.
please note that cook server
's argument parsing is quite broken:
$ cook server
INFO Listening on 127.0.0.1:9080
^C INFO Stopping server
INFO Server stopped
$ cook server .
INFO Listening on 127.0.0.1:9080
^C INFO Stopping server
INFO Server stopped
$ cook server --host 192.168.122.10
INFO Listening on 0.0.0.0:9080
^C INFO Stopping server
INFO Server stopped
$ cook server --host 127.0.0.1
INFO Listening on 0.0.0.0:9080
^C INFO Stopping server
INFO Server stopped
$ cook server --host 127.0.0.1 .
error: unexpected argument '.' found
Usage: cook server [OPTIONS] [BASE_PATH]
For more information, try '--help'.
$
to summarize:
- passing any argument to
--host
, results in listening to0.0.0.0
instead of127.0.0.1
(including IPv6 addresses, or random garbage) - passing
--host
means we can't pass aBASE_PATH
This confusion is probably best demonstrated when we GNU style, reverse options and arguments:
$ cook server . --host 0.0.0.0
error: unexpected argument '0.0.0.0' found
Usage: cook server [OPTIONS] [BASE_PATH]
For more information, try '--help'.
$