Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions admin_manual/installation/nginx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ webroot of your nginx installation. In this example it is
location ^~ /.well-known {
# The following 6 rules are borrowed from `.htaccess`

rewrite ^/\.well-known/host-meta\.json /public.php?service=host-meta-json last;
rewrite ^/\.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/\.well-known/webfinger /public.php?service=webfinger last;
rewrite ^/\.well-known/nodeinfo /public.php?service=nodeinfo last;

location = /.well-known/carddav { return 301 /remote.php/dav/; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to at some point then also migrate the *dav related well known endpoints

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. @rullzer and I brainstormed about using the new API and having a simple handler in the dav app. Then installations that are hosted in the document root don't ever need to fiddle with the rewrites/redirects.

location = /.well-known/caldav { return 301 /remote.php/dav/; }
# Anything else is dynamically handled by Nextcloud
location ^~ /.well-known { return 301 /index.php$uri; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think $request_uri must be used here as $uri is the normalised/decided URI with query string and anchor removed, which is not what is wanted here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daita could that explain why you sometimes didn't see query parameters?!


try_files $uri $uri/ =404;
}
Expand Down Expand Up @@ -241,14 +238,12 @@ The configuration differs from the "Nextcloud in webroot" configuration above in
location /.well-known {
# The following 6 rules are borrowed from `.htaccess`

rewrite ^/\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json last;
rewrite ^/\.well-known/host-meta /nextcloud/public.php?service=host-meta last;
rewrite ^/\.well-known/webfinger /nextcloud/public.php?service=webfinger last;
rewrite ^/\.well-known/nodeinfo /nextcloud/public.php?service=nodeinfo last;

location = /.well-known/carddav { return 301 /nextcloud/remote.php/dav/; }
location = /.well-known/caldav { return 301 /nextcloud/remote.php/dav/; }

# Anything else is dynamically handled by Nextcloud
location ^~ /.well-known { return 301 /nextcloud/index.php$uri; }

try_files $uri $uri/ =404;
}

Expand Down
16 changes: 3 additions & 13 deletions admin_manual/issues/general_troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,12 @@ URLs:

| ``https://example.com/.well-known/carddav``
| ``https://example.com/.well-known/caldav``
| ``https://example.com/.well-known/webfinger``
|

Those need to be redirecting your clients to the correct endpoints. If Nextcloud
is running at the document root of your Web server the correct URL is:

``https://example.com/remote.php/dav`` for CardDAV and CalDAV and
``https://example.com/public.php?service=webfinger``

and if running in a subfolder like ``nextcloud``:

``https://example.com/nextcloud/remote.php/dav``
``https://example.com/nextcloud/public.php?service=webfinger``
is running at the document root of your Web server the correct URL is
``https://example.com/remote.php/dav`` for CardDAV and CalDAV and if running in a
subfolder like ``nextcloud``, then ``https://example.com/nextcloud/remote.php/dav``.

For the first case the :file:`.htaccess` file shipped with Nextcloud should do
this work for you when you're running Apache. You need to make sure that your
Expand All @@ -271,9 +264,6 @@ document root of your Web server and add the following lines::

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
RewriteRule ^\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
RewriteRule ^\.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]
RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav [R=301,L]
RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav [R=301,L]
</IfModule>
Expand Down