tools icon indicating copy to clipboard operation
tools copied to clipboard

packer: do not query http if https works

Open oliverpool opened this issue 3 months ago • 1 comments

Similar to #78 and #79:

  • my own application listens on port 80
  • gokrazy is managed via https (on port 443)
  • I set the gokrazy http port to 8080 (but it should be disabled ideally)

Currently when I try to make an update and nothing is listening on port 80, I get:

> gok update
2025/09/13 14:40:01 Using certificate /home/user/.config/gokrazy/hosts/gokrazy/cert.pem
[done] in 0.01s
2025/09/13 14:40:01 probing url for https: Get "http://gokrazy": dial tcp 192.168.1.124:80: connect: connection refused

I don't really understand why http is probed, if I want to update via https. At least it should check against to custom port 8080.

In this PR, I propose to probe directly on the https endpoint instead (but this part of the code seems to be quite subtle, and maybe I did something wrong).

oliverpool avatar Sep 13 '25 14:09 oliverpool

With commit https://github.com/gokrazy/tools/commit/9a9519186b1b166c83808face703d256713017b7, I have added a first test for the 'gok update' code path. It’s using a fake HTTP server right now, but I want to switch that to using running the test instance in a VM, and then we can test switching a running instance to TLS and similar.

stapelberg avatar Oct 03 '25 17:10 stapelberg