Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access cook server via LAN #82

Open
2096779623 opened this issue Nov 25, 2023 · 5 comments
Open

Unable to access cook server via LAN #82

2096779623 opened this issue Nov 25, 2023 · 5 comments

Comments

@2096779623
Copy link

2096779623 commented Nov 25, 2023

image
It doesn't have the output like the help page.
image

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 .

@dubadub
Copy link
Member

dubadub commented Nov 25, 2023

@2096779623 could you please check if it helps to start the server with --host option? Like cook server --host. Thanks!

@2096779623
Copy link
Author

Works, but it looks a bit weird and the recipes don't display properly after adding the --host parameter.
Screenshot_20231125-182813_Pixel
Screenshot_20231125-182809_Pixel

@dubadub
Copy link
Member

dubadub commented Nov 25, 2023

Thanks for checking. Yeah, that doesn't look great... It suspiciously look like a CORS issue. I'll have a look.

@igalic
Copy link

igalic commented Apr 10, 2024

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 to 0.0.0.0 instead of 127.0.0.1 (including IPv6 addresses, or random garbage)
  • passing --host means we can't pass a BASE_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'.
$ 

@mathmauney
Copy link
Contributor

Ran into this same issue toady and figured out that --host is a boolean rather than something you pass in an IP to. By passing in --host X.X.X.X it is setting X.X.X.X as the base path for the recipes. Running cook server --host /recipes/ worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants