Wrong URI schema in 301 Location header for .well-known with docker image

Hi :slight_smile:

Nextcloud version: 26.0.6
Operating system and version: linux/docker
Apache or nginx version: nginx for TLS + apache from docker
PHP version: from docker

The issue you are facing:

Your web server is not properly set up to resolve "/.well-known/ca(l|rd)dav"

# curl -i https://domain/.well-known/caldav
HTTP/2 301
server: nginx/1.22.1
date: Sun, 10 Sep 2023 21:56:55 GMT
content-type: text/html; charset=iso-8859-1
content-length: 325
referrer-policy: no-referrer
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-robots-tag: noindex, nofollow
x-xss-protection: 1; mode=block
location: http://domain/remote.php/dav/

(note the first and last line)

Is this the first time you’ve seen this error? N

Steps to replicate it:

  1. Run Nextcloud from Docker image
  2. Use nginx to terminate TLS
  3. Test using curl or ‘Site Administration’ tool


'overwriteprotocol' => 'https',
'overwrite.cli.url' => 'https://domain',

nginx config:

  location / {
    proxy_pass http://docker_nextcloud;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

I’ve tried adding proxy_set_header X-Scheme $scheme; but it doesn’t affect the output.
Adding :$server_port to the Host header does change the output but doesn’t fix the issue.
Is there a way to get the container image to use the URI scheme when assembling the Location header?