Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEXTCLOUD_TRUSTED_DOMAINS only sets first domain in list #1666

Open
BornToBeRoot opened this issue Jan 2, 2022 · 14 comments
Open

NEXTCLOUD_TRUSTED_DOMAINS only sets first domain in list #1666

BornToBeRoot opened this issue Jan 2, 2022 · 14 comments
Labels
bug feature: auto config (environment variables) Auto configuring via environment variables

Comments

@BornToBeRoot
Copy link

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',
  ),
@novaliswolf
Copy link

Also having the same issue on version: 24.0.1

@jwaes
Copy link

jwaes commented Sep 8, 2022

Also having this issue ...

@im2c0ol
Copy link

im2c0ol commented Oct 3, 2022

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

@LinuxMeow
Copy link

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".

@Ramalama2
Copy link

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

@rudolphh
Copy link

rudolphh commented Dec 8, 2022

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

@ariep
Copy link

ariep commented Dec 15, 2022

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.

@nel0x
Copy link

nel0x commented Jan 6, 2023

@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.

@BornToBeRoot
Copy link
Author

@nel0x yes. I think it was that domain.

@sebastiansam55
Copy link

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
Copy link

sebastiansam55 commented Jan 12, 2023

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.

@Cadish
Copy link

Cadish commented Aug 19, 2023

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

@rmelotte
Copy link

rmelotte commented Oct 4, 2023

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

@joshtrichards joshtrichards added bug feature: auto config (environment variables) Auto configuring via environment variables labels Oct 23, 2023
@steljwagh
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feature: auto config (environment variables) Auto configuring via environment variables
Projects
None yet
Development

No branches or pull requests