Have been using Nextcloud with Collabora for years without trouble. Suddenly some users have problems and see Document loading failed. Found a way to reproduce this: Firefox loads the doc fine, Chrome fails.
This is new.
Drilling down, the most likely reason is a difference in the incoming request. To clarify I use lighttpd on the gateway which forwards requests to the back end server and it has held tis config for years:
$HTTP["host"] =~ "^cloud\." {
proxy.server = ( "" => ( ( "host" => ip_cloud ) ) )
}
else $HTTP["host"] =~ "^office\." {
# Collabora essentially has two types of communication both over the port it listens on
# (9980). Websockets, that need the Upgrade header and Connection header set and static
# files that don't. They provide detailed expamples for Apache and Nginx considering every
# form of URL they want, but we can distil two categories easily enough.
$REQUEST_HEADER["Upgrade"] == "websocket" {
setenv.add-request-header = ("Connection" => "Upgrade")
proxy.header = ( "upgrade" => "enable" )
proxy.server = ( "" => ( ( "host" => ip_cloud, "port" => port_cool, "upgrade" => "enable" ) ) )
} else {
proxy.server = ( "" => ( ( "host" => ip_cloud ) ) )
}
} else {
proxy.server = ( "" => ( ( "host" => ip_live ) ) )
}
Now up front yes, I understand the world tends to use Apache, the nginx, and you may not be familiar with lighttpd configs and nor am I needing that directly, much rather I’m looking to explain how things worked for years comfortably and why I believe they’ve suddenly broken and how that is diagnosed.
So up front the above config is on a gateway and simply takes and cloud.
URLs and forwards them on to the backend server, and handles office.
URLS with more nuance as follows. If “Upgrade: websocket” appears in the HTTP headers forward on to coolwsd server, FYI:
var.port_cool = "9980"
If it doesn’t have “Upgrade: websocket” in hte HTTP headers it’s s tatic file request and it forwards on to the webserver on ip_cloud which delivers the static files.
Finally, if it’s not cloud.
or office.
it just forwards on to a generic webserver on hte backed (at ip_live).
How did I diagnose the issue:
By examining lighttpd tracing logs and coolwsd tracing logs. What that reveals:
- Firefox sends an HTTP 1.1 GET request with “Upgrade: websocket” and all is good.
- Chrome sends an HTTP 2.0 CONNECT request which isn’t handled.
I infer this is a new thing in Chrome (and perhaps other clients) and the consequence is the CONNECT request is just sent unaltered to the webserver at ip_cloud not the coolwsd’s websocket on port_cool.
My questions are simple:
- Does this sound familiar, has anyone else encountered this?
- When I try to forward the CONNECT requests to coolwsd it seems not to work alas. Rally I just add a new condition:
$HTTP["host"] =~ "^cloud\." {
proxy.server = ( "" => ( ( "host" => ip_cloud ) ) )
}
else $HTTP["host"] =~ "^office\." {
# Collabora essentially has two types of communication both over the port it listens on
# (9980). Websockets, that need the Upgrade header and Connection header set and static
# files that don't. They provide detailed expamples for Apache and Nginx considering every
# form of URL they want, but we can distil two categories easily enough.
$REQUEST_HEADER["Upgrade"] == "websocket" {
setenv.add-request-header = ("Connection" => "Upgrade")
proxy.header = ( "upgrade" => "enable" )
proxy.server = ( "" => ( ( "host" => ip_cloud, "port" => port_cool, "upgrade" => "enable" ) ) )
} else $HTTP["request-method"] == "CONNECT" {
proxy.server = ( "" => ( ( "host" => ip_cloud, "port" => port_cool, "upgrade" => "enable" ) ) )
} else {
proxy.server = ( "" => ( ( "host" => ip_cloud ) ) )
}
} else {
proxy.server = ( "" => ( ( "host" => ip_live ) ) )
}
That is, if the request method is CONNECT forward to port_cool. Alas, lighttpd is getting a 405 (Method Not Allowed) back from coolwsd and forwarding that to the client it seems. At least that is my provisional diagnosis.
Which is why the second question is really:
Is there come coolwsd config I need to attend to for it to accept HTTP 2.0 CONNECT requests on its port 9980? or worse, have I misunderstood something profound?