Describe the bug
The Server field in the web config (OC_URL / WEB_UI_CONFIG_SERVER) is meant to fall back to the browser's current origin when left empty, so the same OpenCloud instance can be reached through multiple hostnames. In practice, setting it empty still results in the literal string "/" being sent to the frontend, which breaks all API calls.
Expected behavior
With Server empty, the frontend should fall back to window.location.origin (this fallback already exists client-side) and all API requests should work normally regardless of which hostname was used to reach the instance.
Actual behavior
The web app fails immediately with:
Failed to construct 'URL': Invalid URL
The server always appends a trailing slash to Server, even when it's empty, turning it into "/". Since "/" is a non-empty string, the frontend's fallback to window.location.origin never triggers, and "/" gets passed to the WebDAV/Graph/OCS clients as their base URL, which the browser's native URL() constructor rejects, since a base URL needs a scheme and host, not just a path.
Setup
Docker Compose (opencloud-compose), external reverse proxy, external OIDC provider.
Details
OC_URL=https://cloud.example.com
WEB_UI_CONFIG_SERVER=
Additional context
From my AI Agent:
Root cause in services/web/pkg/service/v0/service.go, getPayload:
webConfig.Server = strings.TrimRight(webConfig.Server, "/") + "/"
This runs unconditionally, so an empty Server becomes "/" instead of staying empty.
Suggested fix: skip the trailing slash when Server is empty:
if webConfig.Server != "" {
webConfig.Server = strings.TrimRight(webConfig.Server, "/") + "/"
}
For comparison, the ThemeServer/webConfig.Theme construction a few lines above doesn't have this bug. An empty ThemeServer correctly produces a relative theme path, since url.Parse("").String() returns "".
Describe the bug
The Server field in the web config (
OC_URL/WEB_UI_CONFIG_SERVER) is meant to fall back to the browser's current origin when left empty, so the same OpenCloud instance can be reached through multiple hostnames. In practice, setting it empty still results in the literal string "/" being sent to the frontend, which breaks all API calls.Expected behavior
With Server empty, the frontend should fall back to window.location.origin (this fallback already exists client-side) and all API requests should work normally regardless of which hostname was used to reach the instance.
Actual behavior
The web app fails immediately with:
The server always appends a trailing slash to Server, even when it's empty, turning it into "/". Since "/" is a non-empty string, the frontend's fallback to window.location.origin never triggers, and "/" gets passed to the WebDAV/Graph/OCS clients as their base URL, which the browser's native URL() constructor rejects, since a base URL needs a scheme and host, not just a path.
Setup
Docker Compose (opencloud-compose), external reverse proxy, external OIDC provider.
Details
OC_URL=https://cloud.example.com
WEB_UI_CONFIG_SERVER=
Additional context
From my AI Agent:
Root cause in
services/web/pkg/service/v0/service.go,getPayload:This runs unconditionally, so an empty Server becomes "/" instead of staying empty.
Suggested fix: skip the trailing slash when Server is empty:
For comparison, the ThemeServer/webConfig.Theme construction a few lines above doesn't have this bug. An empty ThemeServer correctly produces a relative theme path, since
url.Parse("").String()returns "".