Auth-header denied connection when username length >= 30
Author: MarisaDAZACreated Jun 23, 2026Updated Jul 11, 2026
Labelsbug
Describe the bug
Auth-header denied connection when username length >= 30.
When using ttyd with the --auth-header (-H) parameter, if the authenticated username is more than 30 characters, /token will return empty string and ttyd will reject /ws:
W: User code denied connection
And website shows: Press enter to reconnect
To Reproduce
Using nginx reverse proxy with:
proxy_set_header X-TTYD-Auth $remote_user;
Start ttyd:
ttyd -H X-TTYD-Auth bash
Expected behavior ttyd should accept any valid username
Environment:
- OS: Linux Fedora 44 aarch64
- Browser: Firefox 152.0 ,
Source: tsl0922/ttyd