Modified .htaccess and now have "Error occurred while checking server setup"

Nextcloud version: 29.0.0
Operating system and version: Ubuntu 22.04.06
Apache or nginx version: Apache 2.4.59
PHP version: 8.1.28

Modified .htaccess and now “Security & setup warnings” page gives error “There are some errors regarding your setup.”

image

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

Steps to replicate it:

  1. Backed up .htaccess
  2. modified original .htaccess file line “RewriteRule ^.well-known/carddav /remote.php/dav/ [R=301,L]” (I KNOW, BAD IDEA)
  3. resulted in error on “Security & setup warnings” page
  4. removed changes to .htaccess
  5. same error message
  6. updated owner / permissions of .htaccess backup
  7. deleted original .htaccess
  8. renamed .htaccess backup to .htaccess
  9. still have same error issue…

image

Any idea why the system check would break after modifying and reverting back to the original .htaccess file?

Thanks!

Can you tell us what exactly the modification was that you applied?


ernolf

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 /nextcloud/remote.php/dav/ [R=301,L]
RewriteRule ^.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]

The error came up when checking server setting so changed it back but that didn’t fix the error. The reverted to the original file using the backup and the error is still there when checking server setup.

The server seems to run fine other than the error on the “Security and setup waning” page.

File size was the same after removing the changes to the original file and owner / permissions on the backup .htaccess file are the same as the original.

Could you please call it from within an incognito tab or window? The test from the server is done with a little portion of java script by attempting to make a request from JS to https://your-domain.com/.well-known/caldav/ and may still be inside of your browser cache.


Much and good luck,
ernolf

If you want to make changes like that, I would want to encourage you to do it the way which was mentioned for that purpose with the special tools provided as described → in the manual ←


Much and good luck
ernolf

Unfortunately moving to a different browser, an incognito session or a firejail version of Firefox didn’t help.

Comparing the .htaccess file on the server with the .htaccess file supplied with the latest download version of Nextcloud shows they are identical. Any other suggestions on why the change could be stuck in the server?

Also, do you think the next Nextcloud update possibly sort this out when it re-writes .htaccess?

Did you try to go to

  • https://your-domain.com/.well-known/caldav/

in your browser?

If it shows you

This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

then everything is working fine and you can disable the check in config/config.php with

  'check_for_working_wellknown_setup' => false,

you don’t have to wait until an update. I linked you to the manual, there you find the occ command to do exactly that step which is executed after an update:

occ maintenance:update:htaccess

Much and good luck,
ernolf

Unfortunately there is an issue with my redirect because pointing to https://your-domain.com/.well-known/caldav/ results in:

“Page not found
The page could not be found on the server or you may not be allowed to view it.”

My Apache Nextcloud server is behind an NGINX reverse proxy so I’ll have to do some digging to get that sorted. The caldav RewriteRule in the NGINX conf file worked before updating to 29.0.0 but the configuration obviously changed after the update.

Running the “occ maintenance:update:htaccess” command updated the .htaccess file but the warning page is still not working 100%. I can access the “Security & setup warnings” page using the “Administrative Settings” menu but if I refresh the page I get the “There are some errors regarding your setup.” error again. Weird.

I plan to rebuild the server in a few months so I think I’ll live with the issues until then unless anyone has any additional input.

Thanks for your help.

Aha! And why you did not provide that important information? I am not clairvoiant!

You must understand: A “301” redirection is considered permanent and that means, that your proxy may cache that for faster response.

Try clearing the nginx proxy cache:

sudo rm -rf /var/cache/nginx/*

and restart

sudo systemctl restart nginx

hth


Much and good luck,
ernolf