Hello everyone!
I need to setup AIO within rootless docker to listen for an arbitrary port. After thorough docs investigation and few attempts I ended up with ‘nextcloud/all-in-one:beta’ image (because it allows to use SKIP_DOMAIN_VALIDATION) and apache as a reverse proxy. I almost successfully went through the initial setup but finally got a situation where nextcloud redirects every transition to https://my.server.tld instead of https://my.server.tld:1234 which I am going to use.
I ran docker as
docker run -it --name nextcloud-aio-mastercontainer --restart always -p 8080:8080 -e APACHE_PORT=11000 --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume /run/user/1004/docker.sock:/var/run/docker.sock:ro -e NEXTCLOUD_DATADIR="/bucket/nextcloud" -e DOCKER_SOCKET_PATH=/run/user/1004/docker.sock -e SKIP_DOMAIN_VALIDATION=true nextcloud/all-in-one:beta
made apache config like
<VirtualHost _default_:1234>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/my.server.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my.server.tld/privkey.pem
ProxyPreserveHost On
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/(.*) "ws://localhost:11000/$1" [P,L]
ProxyPass / http://localhost:11000/
ProxyPassReverse / http://localhost:11000/
Protocols h2 h2c http/1.1
TraceEnable off
<Files ".ht*">
Require all denied
</Files>
ServerName my.server.tld
ServerAlias *.my.server.tld
</VirtualHost>
and created /var/www/html/config/myown.config.php within nextcloud-aio-nextcloud container with the following content
<?php
$CONFIG['overwritehost'] = 'my.server.tld:1234';
$CONFIG['overwrite.cli.url'] = 'https://my.server.tld:1234/';
But every time I open https://my.server.tld:1234
it redirects me to the https://my.server.tld/login
If then I manually open https://my.server.tld:1234/login
I got to the appropriate login page, but after login it brings me to the https://my.server.tld/apps/dashboard/
which obviously does not exist.
After that I can manually open https://my.server.tld:1234/apps/dashboard/
and work normally until some redirect occurs (e.g. at logoff) and it brings me back to https://my.server.tld/*
(e.g. with no port)
However the mystery itself is with the following:
user@my:~$ docker exec -it nextcloud-aio-nextcloud grep my.server.tld /var/www/html/config/config.php /var/www/html/config/myown.config.php
/var/www/html/config/config.php: 'overwritehost' => 'my.server.tld',
/var/www/html/config/config.php: 1 => 'my.server.tld',
/var/www/html/config/config.php: 'overwrite.cli.url' => 'https://my.server.tld/',
/var/www/html/config/myown.config.php: $CONFIG['overwritehost'] = 'my.server.tld:1234';
/var/www/html/config/myown.config.php: $CONFIG['overwrite.cli.url'] = 'https://my.server.tld:1234/';
user@my:~$ docker exec -it nextcloud-aio-nextcloud php occ config:system:get overwritehost
my.server.tld
user@my:~$ docker exec -it nextcloud-aio-nextcloud php occ config:system:get overwrite.cli.url
https://my.server.tld:1234/
user@my:~$ docker exec -it nextcloud-aio-nextcloud php occ config:system:set overwritehost --value="my.server.tld:1234"
System config value overwritehost set to string my.server.tld:1234
user@my:~$ docker exec -it nextcloud-aio-nextcloud php occ config:system:set overwrite.cli.url --value="https://my.server.tld:1234/"
System config value overwrite.cli.url set to string https://my.server.tld:1234/
user@my:~$ docker exec -it nextcloud-aio-nextcloud php occ config:system:get overwritehost
my.server.tld
user@my:~$ docker exec -it nextcloud-aio-nextcloud php occ config:system:get overwrite.cli.url
https://my.server.tld:1234/
user@my:~$ docker exec -it nextcloud-aio-nextcloud grep my.server.tld /var/www/html/config/config.php /var/www/html/config/myown.config.php
/var/www/html/config/config.php: 'overwritehost' => 'my.server.tld:1234',
/var/www/html/config/config.php: 1 => 'my.server.tld',
/var/www/html/config/config.php: 'overwrite.cli.url' => 'https://my.server.tld:1234/',
/var/www/html/config/myown.config.php: $CONFIG['overwritehost'] = 'my.server.tld:1234';
/var/www/html/config/myown.config.php: $CONFIG['overwrite.cli.url'] = 'https://my.server.tld:1234/';
I.e. the value of ‘overwritehost’ seems to be desyncronized with both config.php and value available through the ‘php occ’
How could it ever be???
P.S. My installation otherwise looks ok. I am able to upload/download files etc. through the browser with ‘manual interventions’. But both desktop and mobile clients break in this situation at the very login.