Versions
- Nextcloud version: 31.0.0 (latests feb 25th release)
- TrueNAS Scale version: 24.04 (dragonfish):
- Web server I don’t know since I’m running the docker from TrueNAS Scale
- I think inside the docker, there’s a nginx container as well, but:
- Using cloudflared to access remotely: version is latests available on truenas scale
- Is this the first time you’ve seen this error? (Yes / No): Yes, it has happened ever since i bought a domain and I’m only making an issue now.
- When did this problem seem to first start? Ever since buying and using a domain
- Are you using CloudfIare, mod_security, or similar? (Yes / No) - I’m using CloudflareD, so yeah i think
The Issue
In certain parts of the service, Nextcloud will give the local IP instead of the domain, No matter from where you access it.
Examples:
- Trying to login, or the initial redirect → redirects properly but to the local IP instead of continuing the domain
- Sharing a file returns the URL with an IP instead of domain name - And even when you modify it when you send it, for videos, i can see it is making a query to the local ip (so it’ll look like the content is unavailable, but I can see it’s looking for the ip, caused me so much trouble)
- The WebDAV example URL to copy+paste don’t use the domain
Steps to replicate it
- Configure nextcloud container in TrueNAS Scale to use the local IP, initially intended to use Tailscale
- Setup cloudflared on TrueNAS Scale, which should → redirect nextcloud.example.com to 192.168.0.1:9001
- CloudflareD does the job, it shows the website
- Find the current issue - domain returns the IP
- Try configuring
/config/config.php
and setting every overwrite host values domains to use nextcloud.example.com (mentioned below) - Nextcloud behaves the same
Said thing managed to fix the fact that the domain wasn’t even allow, but setting it as a trusted domain worked.
Configuration
Nextcloud
# occ config:list
{
"system": {
"htaccess.RewriteBase": "\/",
"memcache.local": "\\OC\\Memcache\\APCu",
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/custom_apps",
"url": "\/custom_apps",
"writable": true
}
],
"memcache.distributed": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"password": "***REMOVED SENSITIVE VALUE***",
"port": 6379
},
"upgrade.disable-web": true,
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"nextcloud.MYDOMAIN.COM",
"nextcloud",
"MY.LOCAL.IP.ADDRESS",
"localhost",
"127.0.0.1",
"nextcloud-init-sync.lock"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "pgsql",
"version": "31.0.0.18",
"overwrite.cli.url": "https:\/\/[nextcloud.MYDOMAIN.COM]",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"instanceid": "***REMOVED SENSITIVE VALUE***",
"overwritehost": "[MY.LOCAL.IP.ADDRESS]",
"overwriteprotocol": "https",
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"app_install_overwrite": [
"pandoc"
],
"loglevel": 0,
"maintenance": false
},
"apps": {
"activity": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "4.0.0"
},
"app_api": {
"types": "",
"enabled": "yes",
"installed_version": "5.0.2"
},
"backgroundjob": {
"lastjob": "103"
},
"bruteforcesettings": {
"types": "",
"enabled": "yes",
"installed_version": "4.0.0"
},
"calendar": {
"types": "",
"enabled": "yes",
"installed_version": "5.2.1"
},
"cfg_share_links": {
"types": "",
"enabled": "yes",
"installed_version": "7.0.1"
},
"circles": {
"types": "filesystem,dav",
"enabled": "yes",
"installed_version": "31.0.0-dev.0",
"loopback_tmp_scheme": "https",
"migration_22": "1",
"maintenance_update": "{\"3\":1744399804,\"2\":1744401604,\"1\":1744401604}",
"maintenance_run": "0",
"migration_run": "0"
},
"cloud_federation_api": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "1.14.0"
},
"comments": {
"types": "logging",
"enabled": "yes",
"installed_version": "1.21.0"
},
"contactsinteraction": {
"types": "dav",
"enabled": "yes",
"installed_version": "1.12.0"
},
"core": {
"installedat": "1733093835.5345",
"vendor": "nextcloud",
"public_files": "files_sharing\/public.php",
"lastupdatedat": 1744395363,
"backgroundjobs_mode": "cron",
"lastcron": 1744401645,
"moveavatarsdone": "yes",
"previewsCleanedUp": "1",
"metadataGenerationDone": true,
"lastupdateResult": "{\"version\":\"31.0.3.2\",\"versionstring\":\"Nextcloud 31.0.3\",\"url\":\"https:\\\/\\\/download.nextcloud.com\\\/server\\\/releases\\\/nextcloud-31.0.3.zip\",\"web\":\"https:\\\/\\\/docs.nextcloud.com\\\/server\\\/31\\\/admin_manual\\\/maintenance\\\/upgrade.html\",\"changes\":\"https:\\\/\\\/updates.nextcloud.com\\\/changelog_server\\\/?version=31.0.3\",\"autoupdater\":\"1\",\"eol\":\"0\"}",
"files_metadata": {
"photos-original_date_time": {
"value": null,
"type": "int",
"etag": "",
"indexed": true,
"editPermission": 0
},
"photos-exif": {
"value": null,
"type": "array",
"etag": "",
"indexed": false,
"editPermission": 0
},
"photos-ifd0": {
"value": null,
"type": "array",
"etag": "",
"indexed": false,
"editPermission": 0
},
"photos-size": {
"value": null,
"type": "array",
"etag": "",
"indexed": false,
"editPermission": 0
},
"blurhash": {
"value": null,
"type": "string",
"etag": "3d507662260bb63db4e58830b49b7cf7",
"indexed": false,
"editPermission": 0
},
"files-live-photo": {
"value": null,
"type": "string",
"etag": "",
"indexed": false,
"editPermission": 1
}
},
"oc.integritycheck.checker": []
},
"dashboard": {
"types": "",
"enabled": "yes",
"installed_version": "7.11.0"
},
"dav": {
"types": "filesystem",
"enabled": "yes",
"regeneratedBirthdayCalendarsForYearFix": "yes",
"buildCalendarSearchIndex": "yes",
"builtSocialSearchIndex": "yes",
"buildCalendarReminderIndex": "yes",
"installed_version": "1.33.0",
"chunks_migrated": "1"
},
"deck": {
"enabled": "yes",
"types": "dav",
"installed_version": "1.15.0"
},
"drawio": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "3.0.9"
},
"federatedfilesharing": {
"types": "",
"enabled": "yes",
"installed_version": "1.21.0"
},
"federation": {
"types": "authentication",
"enabled": "yes",
"installed_version": "1.21.0"
},
"files": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "2.3.1"
},
"files_downloadlimit": {
"types": "",
"enabled": "yes",
"installed_version": "4.0.0"
},
"files_pdfviewer": {
"types": "",
"enabled": "yes",
"installed_version": "4.0.0"
},
"files_reminders": {
"types": "",
"enabled": "yes",
"installed_version": "1.4.0"
},
"files_sharing": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "1.23.1"
},
"files_trashbin": {
"types": "filesystem,dav",
"enabled": "yes",
"installed_version": "1.21.0"
},
"files_versions": {
"types": "filesystem,dav",
"enabled": "yes",
"installed_version": "1.24.0"
},
"firstrunwizard": {
"enabled": "yes",
"types": "",
"installed_version": "4.0.0"
},
"intros": {
"types": "",
"installed_version": "1.1.2",
"enabled": "yes"
},
"libresign": {
"enabled": "no",
"types": "",
"installed_version": "10.6.4"
},
"logreader": {
"types": "logging",
"enabled": "yes",
"installed_version": "4.0.0"
},
"lookup_server_connector": {
"types": "authentication",
"enabled": "yes",
"installed_version": "1.19.0"
},
"nextcloud_announcements": {
"types": "logging",
"enabled": "yes",
"installed_version": "3.0.0",
"pub_date": "Thu, 24 Oct 2019 00:00:00 +0200"
},
"notes": {
"installed_version": "4.11.0",
"types": "",
"enabled": "yes"
},
"notifications": {
"types": "logging",
"enabled": "yes",
"installed_version": "4.0.0"
},
"oauth2": {
"types": "authentication",
"enabled": "yes",
"installed_version": "1.19.1"
},
"pandoc": {
"installed_version": "0.7.0",
"types": "",
"enabled": "yes"
},
"password_policy": {
"types": "authentication",
"enabled": "yes",
"installed_version": "3.0.0"
},
"photos": {
"types": "dav,authentication",
"enabled": "yes",
"installed_version": "4.0.0-dev.1",
"lastPlaceMappedUser": "admin",
"lastPlaceMappingDone": "true"
},
"privacy": {
"types": "",
"enabled": "yes",
"installed_version": "3.0.0"
},
"profile": {
"installed_version": "1.0.0",
"types": "",
"enabled": "yes"
},
"provisioning_api": {
"types": "prevent_group_restriction",
"enabled": "yes",
"installed_version": "1.21.0"
},
"recommendations": {
"types": "",
"enabled": "yes",
"installed_version": "4.0.0"
},
"related_resources": {
"types": "",
"enabled": "yes",
"installed_version": "2.0.0"
},
"richdocuments": {
"types": "prevent_group_restriction",
"wopi_url": "https:\/\/[MY.LOCAL.IP.ADDRESS:PORT]\/custom_apps\/richdocumentscode\/proxy.php?req=",
"disable_certificate_verification": "",
"enabled": "no",
"installed_version": "8.5.5"
},
"richdocumentscode": {
"enabled": "no",
"types": "",
"installed_version": "24.4.1302"
},
"serverinfo": {
"types": "",
"enabled": "yes",
"installed_version": "3.0.0",
"cached_count_storages": "3",
"cached_count_filecache": 4549,
"size_appdata_storage": -1,
"cached_count_appdata_files": 2864
},
"settings": {
"types": "",
"installed_version": "1.14.0",
"enabled": "yes"
},
"sharebymail": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "1.21.0"
},
"support": {
"types": "session",
"enabled": "yes",
"installed_version": "3.0.0",
"SwitchUpdaterServerHasRun": "yes"
},
"survey_client": {
"types": "",
"enabled": "yes",
"installed_version": "3.0.0"
},
"systemtags": {
"types": "logging",
"enabled": "yes",
"installed_version": "1.21.1"
},
"tasks": {
"installed_version": "0.16.1",
"types": "",
"enabled": "yes"
},
"text": {
"types": "dav",
"enabled": "yes",
"installed_version": "5.0.0"
},
"theming": {
"types": "logging",
"enabled": "yes",
"installed_version": "2.6.1"
},
"twofactor_backupcodes": {
"types": "",
"enabled": "yes",
"installed_version": "1.20.0"
},
"updatenotification": {
"types": "",
"enabled": "yes",
"installed_version": "1.21.0",
"intros": "1.1.2",
"drawio": "3.0.9",
"whiteboard": "1.0.5",
"cfg_share_links": "7.0.1",
"core": "31.0.3.2",
"calendar": "5.2.1",
"richdocumentscode": "24.4.1002",
"deck": "1.14.4",
"update_check_errors": 0
},
"user_status": {
"types": "",
"enabled": "yes",
"installed_version": "1.11.0"
},
"viewer": {
"types": "",
"enabled": "yes",
"installed_version": "4.0.0"
},
"weather_status": {
"types": "",
"enabled": "yes",
"installed_version": "1.11.0"
},
"webhook_listeners": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "1.2.0"
},
"whiteboard": {
"enabled": "yes",
"installed_version": "1.0.5",
"types": ""
},
"workflowengine": {
"types": "filesystem",
"enabled": "yes",
"installed_version": "2.13.0"
}
}
}
# cat config/config.php
<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'nextcloud-redis',
'password' => '[REDACTED]',
'port' => 6379,
),
'upgrade.disable-web' => true,
'passwordsalt' => '[REDACTED]',
'secret' => '[REDACTED]',
'trusted_domains' =>
array (
0 => 'nextcloud.MYDOMAIN.COM',
1 => 'nextcloud',
2 => 'MY.LOCAL.IP.ADDRESS',
3 => 'localhost',
4 => '127.0.0.1',
5 => 'nextcloud-init-sync.lock',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'pgsql',
'version' => '31.0.0.18',
'overwrite.cli.url' => 'https://nextcloud.MYDOMAIN.COM',
'dbname' => 'nextcloud',
'dbhost' => 'nextcloud-postgres:5432',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_admin',
'dbpassword' => '[REDACTED]',
'installed' => true,
'instanceid' => '[REDACTED]',
'overwritehost' => 'nextcloud.MYDOMAIN.COM',
'overwriteprotocol' => 'https',
'trusted_proxies' =>
array (
0 => '172.17.0.0/16',
1 => '172.16.0.0/16',
2 => '127.0.0.1',
3 => 'MY.LOCAL.IP.ADDRESS',
),
'app_install_overwrite' =>
array (
0 => 'pandoc',
),
'loglevel' => 0,
'maintenance' => false,
);
What I tried
I tried configuring /config/config.php
in the nextcloud container, and that didn’t seem to work. overwrite.cli.url
didn’t do the trick, and neither did overwritehost
.
Note that using the domain by itself works sometimes, in certain areas. And so does the IP. It’s not that it always happens.
Related
Didn’t work for me, it’s not an always problem, just sometimes:
Issue on Github:
PR where it is supposed to be fixed: (might not be the same one if so)
Notes, extra info
There’s a host
option in TrueNAS Scale. Said option changes where it should be hosted at. I can’t set the domain here since I’m using cloudflare to manage that, the DNS resolving n stuff. And I need to have a resolvable domain, so an IP, that I can feed to cloudflareD. This is likely a big factor, but I don’t know how work around it.
If you feel like this is totally related to TrueNAS, I’ll try making an issue on their forums.