I've been looking for hours for a solution to my problem, the chromium browser & touchUI not connecting properly and getting the TouchUI error "Cannot connect".
Part of the solution is in the post @foosel made here:
~/oprint/bin/octoprint config set --bool server.allowFraming true
sudo service octoprint restart
sudo service touchui restart
That solves the framing problem, but not the connection problem. What I've found to be working is:
sudo nano etc/default/touchui
then edit the line:
and change it to:
This may be a "hack" but at least I get the OctoPi interface to work on my Raspberry Pi 4B 8Gb.