-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Comments
Also having the same issue on version: 24.0.1 |
Also having this issue ... |
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". |
same here. All i wanted is an easier upgrade method, through containers and traefik etc... Cheers |
And seeing issues from even last year thought this was resolved until now. |
I have the same experience: we regularly install/run the nextcloud docker image as part of a CI run. We set |
@LinuxMeow Can confirm the most recent stable docker release 25.0.2 ignores the
@BornToBeRoot mentioned only the first domain was set. Did you do the initial setup with that domain? |
@nel0x yes. I think it was that domain. |
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? |
well for anyone else, this is possible via from their documentation: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#config-commands-label
EDIT TO ADD: 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. |
Anyone found another solution to this already? Also having the issue with only 1 domain set |
I believe the issue is also visible when at installation, when the container starts for the first time:
|
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 |
i also encounter the same issue in may 2024. it seems the trusted domain is completely ignore |
There are differences in handling of environment variables across Docker Compose versions unfortunately. I suspect that's part of these reports the last couple years. There are also other factors like shell interpretation, if using The original PR #500 used If you're still having problems with
|
It's definitely not ignored. I used it daily. :-) But only works at installation time (once). Please post details of your situation if it's not working. If there is a bug, can't be fixed if we can't reproduce it. For that we need specifics. |
@joshtrichards the problem is not related to docker. Nextcloud doesn't handle the environment variables properly. The environment variables work at installation (for the first time), but changes afterwards to this is ignored. Either you make it clear that it's only for installation or you need to handle updates to this variables. However, in temporary environments with Kubernetes, for example, it should be possible to set (and adjust) such settings dynamically via environment variables. It's doesn't make sense when you define everything as code via something like terraform, deploy it to kubernetes and than you need to manually adjust the config.php file. Pi-hole (Docker) for example will adjust the config based on the environment variables on each time the container starts. https://github.com/pi-hole/docker-pi-hole?tab=readme-ov-file#environment-variables EDIT: It should be possible to set every setting in nextcloud via environment variable (or with a terraform provider 😄 - which unfortunately does not yet exist) |
That is a different discussion. Or at least I thought it was. :-) I thought this issue was about the NEXTCLOUD_TRUSTED_DOMAIN not working at installation time for some of you? Most of the Docker specific variables are installation only. That's similar to other containers, such as the MariaDB one: https://mariadb.com/kb/en/mariadb-server-docker-official-image-environment-variables/ Post-installation Server itself supports As for the Docker variables being for installation time, there are a few spots that's noted, but it sounds like it could be clearer. Feel free to suggest where or submit a PR with the changes. This is a community project. |
The initial issue from ~2 years ago was that The comment from today (making it configurable via variables - or something like a Terraform Provider) is a different discussion. These were just my thoughts on the subject because my requirements have changed since then -.- |
more detailsI already have a Caddy in front of me, so I would like to use caddy to reverse proxy my nextcloud docker, which requires me setting up trusted domain(s). I am a newbie to docker and nextcloud. first try - failedIn host machine's bash, I try the "most simple" command here: sudo docker run \
-p 8080:80 \
-e NEXTCLOUD_TRUSTED_DOMAINS=example.com \
nextcloud Go to http://localhost:8080 , the installation page is shown. I set up a username and password, and use the default sqlite. After the installation completes, in the host machine, I go inside docker machine to check whether the domain is configured. sudo docker ps
# so that I can find out the container id
sudo docker exec -it $containerid bash
## /var/www/html
cat config/config.php
## ...
## 'trusted_domains' =>
## array (
## 0 => 'localhost:8080',
## ),
## ... second try - succeededIn host machine's bash: sudo docker run \
-p 8080:80 \
-e NEXTCLOUD_TRUSTED_DOMAINS=example.com \
-e SQLITE_DATABASE=nextcloudsqlitedb \
-e NEXTCLOUD_ADMIN_USER=admin1 \
-e NEXTCLOUD_ADMIN_PASSWORD=123456 \
nextcloud Then I go to http://localhost:8080/, I am redirected to http://localhost:8080/login , skipping the installation page. And I can use Go inside docker to check the config: sudo docker ps
# so that I can find out the container id
sudo docker exec -it $containerid bash
## /var/www/html
cd config/
cat config.php
## ...
## 'trusted_domains' =>
## array (
## 0 => 'localhost',
## 1 => 'example.com',
## ),
## ... As we can see, the domain is successfully injected into My thoughtsSo obviously showing up installation page or not makes a difference. A reasonable guess is that during the manual installation, maybe the environment variable is lost or the It seems that user @BornToBeRoot is saying the same thing in the above comment? Maybe I am skimming the readme too fast, but maybe it's better to emphasize this "trick" in bold font in the readme file. |
Is Just modify |
NEXTCLOUD_TRUSTED_DOMAINS must be accompanied by NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD. This is currently expected behavior, but the docs need clean-up. Work in progress in #2224 |
Hi, I've been accessing my Nextcloud service (version 27) from the external domain without problem until today tried to log in from my local network and found the same issue: the config.php only took the first trusted_domains value (which is my domain), and completely ignored my other local entries. I reinstalled the latest Nextcloud docker version (version 29.0.1.1), defining NEXTCLOUD_TRUSTED_DOMAINS along side with NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD (see docker-compose.yml below). I notice the first initialization I can access the admin account creation page both locally and from my domain, but after setting that up, the config.php file only has one entry. Any idea why?
|
Greetings! I too have hit this issue. NextCloud works if I connect over the IP. But the supplied hostname is ignored. Docker-ce: CONFIG: networks:
nextcloud:
driver: 'bridge'
services:
mariadb:
container_name: 'nextcloud-db'
hostname: 'db'
image: 'mariadb:lts'
env_file: "/etc/nextcloud/db.env"
volumes:
- '/var/lib/nextcloud:/var/lib/mysql'
ports:
- '127.0.0.1:3306:3306'
restart: always
networks:
- 'nextcloud'
nextcloud:
container_name: 'nextcloud'
hostname: 'nextcloud'
image: 'nextcloud:28.0.7'
env_file: "/etc/nextcloud/nextcloud.env"
volumes:
- '/data/nextcloud:/var/www/html'
ports:
- '127.0.0.1:8080:80'
restart: 'always'
networks:
- 'nextcloud'
RUN:
RESULT:
EDIT: Wouldn't this be enough? (see entrypoint.sh)
The EDIT2: Just realized the |
@nhohung wrote:
Your Compose lacks the db variables so auto configuration cannot run. The NEXTCLOUD_TRUSTED_DOMAINS is configured after the non-web installer runs. Since you're not specifying enough variables for a full auto-configuration, the NEXTCLOUD_TRUSTED_DOMAINS variable is being ignored, as expected, and the web installer is running. @superstes wrote:
NEXTCLOUD_TRUSTED_DOMAINS is only used at installation time. If you want to change it - or any config parameter after install time and you don't wish to do so manually - you can use auto-config hooks. In theory it could be moved outside the install block, but I fear it would be a serious breaking change. There are many environments out there already that have manually adjusted their |
for all who are interested how i solved this issue. i just mounted the location on local files in volumes. i can easy just edit the local file and update the container. easy going
Just run the docker compose, go to web login of your nextcloud, create an admin user and select your apps, after using the wizards your config files will be written. Here my files. nexcloud docker-compose.yml
db.env File
nginx proxy manager docker-compose.yml
|
Closing since this is a documentation improvement matter at this point, which is covered elsewhere. |
Multiple domains in
NEXTCLOUD_TRUSTED_DOMAINS
separated with spaces are ignored.Example:
docker-compose:
config.php
The text was updated successfully, but these errors were encountered: