docker icon indicating copy to clipboard operation
docker copied to clipboard

NEXTCLOUD_TRUSTED_DOMAINS only sets first domain in list

Open BornToBeRoot opened this issue 3 years ago • 26 comments
trafficstars

Multiple domains in NEXTCLOUD_TRUSTED_DOMAINS separated with spaces are ignored.

Example:

docker-compose:

NEXTCLOUD_TRUSTED_DOMAINS: cloud-test.example.com cloud-test.internal.example.com

config.php

'trusted_domains' =>
  array (
    0 => 'cloud-test.example.com',
  ),

BornToBeRoot avatar Jan 02 '22 03:01 BornToBeRoot

Also having the same issue on version: 24.0.1

novaliswolf avatar Jun 08 '22 11:06 novaliswolf

Also having this issue ...

jwaes avatar Sep 08 '22 10:09 jwaes

Months later trying to get the trusted domain option working using CloudFlare without luck. It's a great tool, but why it's so difficult to get this working externally? I even edited the config.php image Nextcloud version 24.0.5

im2c0ol avatar Oct 03 '22 04:10 im2c0ol

For me it doesn't set even the first domain. I set only one. Then went on installation phase and page says "Access through untrusted domain".

LinuxMeow avatar Nov 08 '22 21:11 LinuxMeow

same here. pretty annoying with all that nextcloud docker issues.

All i wanted is an easier upgrade method, through containers and traefik etc... and its actually working all great, but this nextcloud docker container is just annoying. i think its actually better to switch to a normal nginx instance.

Cheers

Ramalama2 avatar Dec 02 '22 16:12 Ramalama2

And seeing issues from even last year thought this was resolved until now.

rudolphh avatar Dec 08 '22 05:12 rudolphh

For me it doesn't set even the first domain. I set only one. Then went on installation phase and page says "Access through untrusted domain".

I have the same experience: we regularly install/run the nextcloud docker image as part of a CI run. We set NEXTCLOUD_TRUSTED_DOMAINS to a single domain. Sometimes this does not end up in the actual configuration (according to php occ config:system:get trusted_domains): which will be only localhost then. Sometimes it does work and trusted_domains will contain both localhost and the specified domain. I have not found any pattern predicting when it will work.

ariep avatar Dec 15 '22 11:12 ariep

@LinuxMeow Can confirm the most recent stable docker release 25.0.2 ignores the NEXTCLOUD_TRUSTED_DOMAINS environment variable too.

docker exec nextcloud_app_1 printenv NEXTCLOUD_TRUSTED_DOMAINS successfully prints out the defined trusted domain(s), so that's not the issue.

@BornToBeRoot mentioned only the first domain was set. Did you do the initial setup with that domain? Currently, Nextcloud container seems to only set the domain/ip used for inital setup as trusted domain in config.php.

nel0x avatar Jan 06 '23 18:01 nel0x

@nel0x yes. I think it was that domain.

BornToBeRoot avatar Jan 08 '23 15:01 BornToBeRoot

also having this issue, I don't even see that dev has commented on this issue thread. Is this a won't fix or something?

Is there a way to set that value with the occ command?

sebastiansam55 avatar Jan 12 '23 23:01 sebastiansam55

well for anyone else, this is possible via occ but still doesn't resolve the error message in the administration console;

from their documentation: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#config-commands-label

To set one of multiple values, you need to specify the array index as the second name in the config:system:set command, separated by a space. For example, to replace sample.tld with example.com, trusted_domains => 2 needs to be set:

sudo -u www-data php occ config:system:set trusted_domains 2 --value=example.com System config value trusted_domains => 2 set to string example.com

sudo -u www-data php occ config:system:get trusted_domains localhost nextcloud.local example.com

EDIT TO ADD: Also had to add the reverse proxy ip to the trusted_proxies list via the same command format as for trusted_domains.

This made the original warning in the nextcloud dashboard go away, there is still one about the trusted proxies but it appears to be safe to ignore.

sebastiansam55 avatar Jan 12 '23 23:01 sebastiansam55

Anyone found another solution to this already? Also having the issue with only 1 domain set

Cadish avatar Aug 19 '23 20:08 Cadish

I believe the issue is also visible when at installation, when the container starts for the first time:

app_1  | Setting trusted domains…
app_1  | sh: 1: Syntax error: Unterminated quoted string

rmelotte avatar Oct 04 '23 17:10 rmelotte

This issue took me a couple of hours without any solution.

The environment variable NEXTCLOUD_TRUSTED_DOMAINS is useless, it is not populated into the config.php

steljwagh avatar Nov 01 '23 21:11 steljwagh