Changing overwrite.cli.url has no effect

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.2.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Archlinux
  • Web server and version (e.g, Apache 2.4.25):
    • 2.4.62
  • PHP version (e.g, 8.3):
    • 8.3.14
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • Not sure
  • Installation method (e.g. AIO, NCP, Bare Metal/Archive, etc.)
    • Bare Metal/Archive
  • Are you using Cloudflare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I added an additional DNS Domain to my Server which became the new main Domain. This worked so far with every service i setup instead of Nextcloud.

I grepped the Nextcloud directory for instances with the Old Domain Name and found

  • trusted_domains
  • overwrite.cli.url
  • mail_domain

I left the domain in trusted_domains untouched (but added the new one) and changed the overwrite.cli.url and mail_domain.

After testing i noticed, that Nextcloud still rewrites to the old Domain name. I then did the following

  • Deleted Cookies/Cache
  • Used a private Session
  • Restarted Apache
  • Checked again with grep
  • Put the instance into maintenance mode and checked if it happens there
  • run the occ repair feature

After all these steps, even though the old domain name is not found via grep anywhere, Nextcloud still redirects to the old domain name.

Steps to replicate it (hint: details matter!):

  1. Modify overwrite.cli.url
  2. Access Nextcloud via the new Domain Name

Log entries

Nextcloud

There are no Log Entries created during the rewrite phase

Web Browser

Nothing relevant in the browser console either (Just a background image that could not be loaded, the new domain name is used when trying to load the background image)

Web server / Reverse Proxy

Nothing of relevance there either, no log entries. access_log looks normal, error_log has no entries.

Configuration

Nextcloud

{
“system”: {
“instanceid”: “REMOVED SENSITIVE VALUE”,
“passwordsalt”: “REMOVED SENSITIVE VALUE”,
“secret”: “REMOVED SENSITIVE VALUE”,
“trusted_domains”: [
“THE_OLD_DNS_NAME”,
“THE_NEW_DNS_NAME”
],
“datadirectory”: “REMOVED SENSITIVE VALUE”,
“dbtype”: “mysql”,
“version”: “30.0.2.2”,
“overwrite.cli.url”: “https://THE_NEW_DNS_NAME/nextcloud”,
“installed”: true,
“mail_smtpmode”: “smtp”,
“mail_smtpauth”: 1,
“mail_sendmailmode”: “smtp”,
“mail_smtpname”: “REMOVED SENSITIVE VALUE”,
“mail_smtppassword”: “REMOVED SENSITIVE VALUE”,
“mail_from_address”: “REMOVED SENSITIVE VALUE”,
“mail_domain”: “THE_NEW_DNS_NAME”,
“mail_smtphost”: “REMOVED SENSITIVE VALUE”,
“mail_smtpport”: “25”,
“enable_previews”: true,
“enabledPreviewProviders”: [
“OC\Preview\Movie”,
“OC\Preview\PNG”,
“OC\Preview\JPEG”,
“OC\Preview\GIF”,
“OC\Preview\BMP”,
“OC\Preview\XBitmap”,
“OC\Preview\MP3”,
“OC\Preview\MP4”,
“OC\Preview\TXT”,
“OC\Preview\MarkDown”,
“OC\Preview\PDF”
],
“maintenance”: false,
“logfile”: “nextcloud.log”,
“memcache.local”: “\OC\Memcache\APCu”,
“theme”: “”,
“loglevel”: 1,
“maintenance_window_start”: 0,
“mysql.utf8mb4”: true,
“dbname”: “REMOVED SENSITIVE VALUE”,
“dbhost”: “REMOVED SENSITIVE VALUE”,
“dbuser”: “REMOVED SENSITIVE VALUE”,
“dbpassword”: “REMOVED SENSITIVE VALUE”,
“memories.db.triggers.fcu”: true,
“memories.exiftool_no_local”: true,
“memories.vod.path”: “/srv/http/nextcloud/apps/memories/bin-ext/go-vod-amd64”,
“memories.vod.ffmpeg”: “/usr/bin/ffmpeg”,
“memories.vod.ffprobe”: “/usr/bin/ffprobe”,
“app_install_overwrite”: [
“maps”
],
“data-fingerprint”: “39a2c55da64ab6479b385872626a5ccf”
}
}

Apps

Enabled:

  • activity: 3.0.0
  • app_api: 4.0.0
  • bruteforcesettings: 3.0.0
  • calendar: 5.0.5
  • circles: 30.0.0
  • cloud_federation_api: 1.13.0
  • comments: 1.20.1
  • contacts: 6.1.1
  • contactsinteraction: 1.11.0
  • dashboard: 7.10.0
  • dav: 1.31.1
  • federatedfilesharing: 1.20.0
  • federation: 1.20.0
  • files: 2.2.0
  • files_downloadlimit: 3.0.0
  • files_pdfviewer: 3.0.0
  • files_reminders: 1.3.0
  • files_sharing: 1.22.0
  • files_trashbin: 1.20.1
  • files_versions: 1.23.0
  • firstrunwizard: 3.0.0
  • forms: 4.3.3
  • logreader: 3.0.0
  • lookup_server_connector: 1.18.0
  • mail: 4.0.3
  • maps: 1.5.0
  • nextcloud_announcements: 2.0.0
  • notes: 4.11.0
  • notifications: 3.0.0
  • oauth2: 1.18.1
  • password_policy: 2.0.0
  • passwords: 2024.11.20
  • photos: 3.0.2
  • previewgenerator: 5.7.0
  • privacy: 2.0.0
  • provisioning_api: 1.20.0
  • recommendations: 3.0.0
  • related_resources: 1.5.0
  • serverinfo: 2.0.0
  • settings: 1.13.0
  • sharebymail: 1.20.0
  • support: 2.0.0
  • survey_client: 2.0.0
  • systemtags: 1.20.0
  • tasks: 0.16.1
  • text: 4.1.0
  • theming: 2.5.0
  • twofactor_backupcodes: 1.19.0
  • updatenotification: 1.20.0
  • user_status: 1.10.0
  • viewer: 3.0.0
  • weather_status: 1.10.0
  • webhook_listeners: 1.1.0-dev
  • workflowengine: 2.12.0
    Disabled:
  • admin_audit: 1.20.0
  • encryption: 2.18.0
  • files_external: 1.22.0
  • suspicious_login: 8.0.0
  • twofactor_nextcloud_notification: 4.0.0
  • twofactor_totp: 12.0.0-dev (installed 10.0.0-beta.2)
  • user_ldap: 1.21.0

To set this into context → All my users access Nextcloud via an Landing Page. I modified the URL on the landing page and when the Landing Page leads to the new URL, it stays at the new URL.

That means https://NEW_DOMAIN/nextcloud does not get rewritten to https://OLD_DOMAIN/nextcloud

But if you access via https://OLD_DOMAIN/nextcloud (via accident or for whatever reason) you stay at OLD_DOMAIN, it does not get rewritten to the new one.

The config.php you posted looks different to the real existing syntax
" instead of ’
= instead of =>

(I am not sure, whether I am on the right way:)
So please check, whther the overwirt.cli.url is like

‘overwrite.cli.url’ => ‘https://THE_NEW_DNS_NAME/nextcloud’,

Seems not to be a trusted domain name. Try THE_OLD_DNS_NAME instead.

1 Like

The Config looks actually like that. But when i use the php occ tool to output the config, it gets changed to what you see.

But i tried both variants, no difference.

overwrite.cli.url mainly affects CLI tools like occ (and notify_push). If you want to rewrite the domain for the Webclients you should set/adjust overwritehost.

Please review 101: reverse proxy for further information

1 Like

(Emphasis added by me)

That is something you handle in your web server (or reverse proxy) configuration.

1 Like

I totally forgot the “cli” Part about that parameter. It is so obvious though. Thanks for clearing things up!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.