Repository navigation
Description
Platform
Linux
Flock version
1.1.1 (source build from main at 346231b)
OS version
Debian GNU/Linux 13 (trixie), x86_64
What happened?
flock link in a project folder whose name cannot become a hostname (for example ~/我的项目, Проект, or a folder named only with punctuation) exits 0, prints linked … → http://.test, and stores a site with an empty name.
The empty name makes the generated web configuration invalid: the domain becomes .test, and the Caddy adapter rejects https://.test with subject does not qualify for certificate: '.test'. While the daemon is already running this only appears as a flock status warning, but the next daemon start (reboot, flock restart, update) never starts the web server, so every site becomes unreachable — including sites that worked before. flock sites lists the broken entry as a row with an empty SITE and URL http://.test.
Expected: flock link rejects a name that cannot be a hostname, tells the user to pass one (flock link <name>), and stores nothing. Site names should be DNS labels, which the codebase already enforces for proxy names (hostLabel in internal/config/domains.go, checked by UpsertProxy), while Config.Upsert does not check the site name and config.SiteName returns "" when every character is replaced.
flock park has the same input path: parking a parent folder that contains a subfolder with an unusable name lists that subfolder as a nameless site too.
Recovery for an affected setup: cd <folder> && flock unlink, then restart the daemon (verified); or remove the nameless entry from config.json.
Steps to reproduce
Reproduced with a daemon built from main at 346231b, run with an isolated FLOCK_HOME and high ports (no system install; PHP is not installed, which is why the site row shows the PHP warning):
- Start the daemon with one working site (
okapp.test).curl -H 'Host: okapp.test' http://127.0.0.1:18080/returns HTTP 404 (the "no index/PHP" page), so the web server is up. mkdir -p /tmp/proj/我的项目 && cd /tmp/proj/我的项目 && flock link→ exit 0, printslinked /tmp/proj/我的项目 → http://.test.flock sites→ a row with an empty SITE and URLhttp://.test.flock status→warning web: adapt web config: subject does not qualify for certificate: '.test'.- Stop and start the daemon again (as
flock restartor a reboot does). curl -H 'Host: okapp.test' http://127.0.0.1:18080/→ HTTP 000 (nothing listens): the web server did not start.
The same folder linked with an explicit name still works (flock link my-project stores my-project.test), and an ASCII folder name links normally.
The Add Site endpoint used by the apps calls config.SiteName in internal/api/configapi.go and passes the result to the same Config.Upsert, so a site added from an app with an unusable name stores the same empty value.
Logs
$ flock link # inside /tmp/proj/我的项目
linked /tmp/proj/我的项目 → http://.test
$ flock sites
SITE PHP URL ROOT PATH
8.5 project folder (detected, no index) /tmp/proj/我的项目
okapp 8.5 project folder (detected) /tmp/proj/okapp
$ flock status # after the daemon restart in step 5
daemon running (pid 171775, v1.1.1, up 10s)
web http :18080, https :18443
warning web: adapt web config: subject does not qualify for certificate: '.test'
$ curl -H 'Host: okapp.test' http://127.0.0.1:18080/
000
After cd /tmp/proj/我的项目 && flock unlink and a daemon restart, okapp.test returns HTTP 404 again and the web-config warning is gone.
Activity
xiaozou-second commentedon Nov 25, 2026
I can take this one.
Proposed fix, following the validation the codebase already has for proxy names:
hostLabel, the same ruleUpsertProxyuses);flock linkexits non-zero with a clear message and tells you to pass a name (flock link <name>) instead of storing an empty site;Config.Upsertrejects an invalid site name, so the Add Site endpoint cannot store one either;Tests would cover
Upsert, the parked-folder path inAllSites, and theflock linkCLI path. I reproduced the current behaviour and verified the corrected behaviour locally on Linux.If you would rather keep deriving the name from the folder and generate a usable one instead of reporting an error, tell me and I will adjust. Otherwise I can open a PR once this issue is approved.
onairmarc commentedon Nov 25, 2026
All yours @xiaozou-second
onairmarc commentedon Nov 25, 2026
Try to keep the folder name where possible, but if there are edge cases, adjust as needed and we can reconvene at review.
github-actions commentedon Nov 25, 2026
Issue claimed by @xiaozou-second in PR #208.