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

cal|carddav not setup properly (.htaccess) #528

Closed
jkaberg opened this issue Oct 27, 2018 · 9 comments
Closed

cal|carddav not setup properly (.htaccess) #528

jkaberg opened this issue Oct 27, 2018 · 9 comments

Comments

@jkaberg
Copy link

jkaberg commented Oct 27, 2018

Running nextcloud:14.0.3 @ https://cloud.domain.tld/ (with Traefik as a reverse proxy in front)

From Settings->Administration->Overview

 There are some warnings regarding your setup.

    Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the documentation.
    Your web server is not properly set up to resolve "/.well-known/carddav". Further information can be found in the documentation.

The documentation can be found here.

Shouldn't this be working by default? The .htaccess file already contains these settings

@SnowMB
Copy link
Contributor

SnowMB commented Oct 31, 2018

I experienced the same warning, but everything seems to work as expected. (I also use traefik as reverse proxy).

I found an issue in the server repo that seems related: nextcloud/server#11850

Might be something with the schema, because if I curl .well-known/carddav it gives me http and not https.

➜  ~ curl -i https://DOMAIN/.well-known/caldav
HTTP/2 301 
content-type: text/html; charset=iso-8859-1
date: Wed, 31 Oct 2018 10:12:25 GMT
location: http://DOMAIN/remote.php/dav/
referrer-policy: strict-origin
server: Apache/2.4.25 (Debian)
strict-transport-security: max-age=31536000; includeSubdomains; preload
content-length: 325

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://DOMAIN/remote.php/dav/">here</a>.</p>
<hr>
<address>Apache/2.4.25 (Debian) Server at DOMAIN Port 80</address>
</body></html>

Will investigate further...

@SnowMB
Copy link
Contributor

SnowMB commented Oct 31, 2018

So this eliminates the warning:

Changing the .htaccess file to

...
  RewriteRule ^\.well-known/carddav https://DOMAIN/remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav https://DOMAIN/remote.php/dav/ [R=301,L]

...

But this is no solution for this image, since we are using the stock .htaccess file. 🤔

@funkypenguin
Copy link

Another Traefik user here..

I similarly changed:

  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]

To:

  RewriteRule ^\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]

And now service discovery works on my iOS devices :)

D

@J0WI
Copy link
Contributor

J0WI commented Dec 12, 2018

This could be fixed with #527

@marceljd
Copy link
Contributor

marceljd commented Feb 9, 2019

Real fix in #644

@SnowMB
Copy link
Contributor

SnowMB commented May 28, 2019

To fix this issue traefik should be configured for the service discovery. In the nexcloud 16 documentation a fix is given.

add the following labels to the nextcloud container:

traefik.frontend.redirect.permanent: 'true'
traefik.frontend.redirect.regex: https://(.*)/.well-known/(card|cal)dav
traefik.frontend.redirect.replacement: https://$$1/remote.php/dav/


@jkaberg
Copy link
Author

jkaberg commented Jun 4, 2019

Thanks @SnowMB for point that out, this resolved it for me.

Feel free to close

@SnowMB SnowMB closed this as completed Jun 5, 2019
@georg90
Copy link

georg90 commented Dec 28, 2021

Anyone trying this with traefik 2.4..

For me this config works on NC 23.0:

nextcloud-redirect:
      redirectRegex:
        permanent: true
        regex: "https://(.*)/.well-known/(card|cal)dav"
        replacement: "https://${1}/remote.php/dav/"

@Nexxus-LMT
Copy link

Anyone trying this with traefik 2.4..

For me this config works on NC 23.0:

nextcloud-redirect:
      redirectRegex:
        permanent: true
        regex: "https://(.*)/.well-known/(card|cal)dav"
        replacement: "https://${1}/remote.php/dav/"

Works for me on rk3s install using traefik. Full Middleware:

kind: Middleware
metadata:
  name: your-name
  namespace: your-namespace
spec:
  redirectRegex:
    permanent: true
    regex: "https://(.*)/.well-known/(card|cal)dav"
    replacement: "https://${1}/remote.php/dav/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants