CORS requires basic auth

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • NextcloudPi_12-03-24
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian GNU/Linux 12. 6.6.62+rpt-rpi-v8 (aarch64)
  • Web server and version (e.g, Apache 2.4.25):
    • Server version: Apache/2.4.62 (Debian) Server built: 2024-10-04T15:21:08
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • which nginx did not return any test
  • PHP version (e.g, 8.3):
    • PHP 8.3.14 (cli) (built: Nov 25 2024 18:23:27) (NTS)
    • Zend Engine v4.3.14
    • Zend OPcache v8.3.14
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • after first installation
  • Installation method (e.g. AIO, NCP, Bare Metal/Archive, etc.)
    • NCP curl script
  • Are you using Cloudflare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

Cannot select the NextcloudPi button on toolbar to successfully navigate to whereever it should take the user.

The JSON message displayed in the browser in response to selecting the NextcloudPi button is:
{“message”:“CORS requires basic auth”}

The user’s session is logged off from NextcloudPi.

P.S. I’ve searched the thread but did not find any answer to my issue.
I imaged the RPi4 using the Foundation’s recommended Bookorm image at their site using their app.
Then I changed the boot order to USB.
Then I ran the curl script to install NextcloudPi

While going through the initial evaluation, I ran into this problem. Other parts of NextcloudPi seem to be working but I don’t know how to fix this nagging issue that logs off the user immediately after the error message is displayed in the browser.

I need help because I’m not very knowledgeable in these matters. Thanks for your understanding.

Regards.

Steps to replicate it (hint: details matter!):

  1. Select the NextcloudPi button on the toolbar
  2. The navigated URL is https://192.168.0.201/index.php/apps/nextcloudpi/

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

{"reqId":"2gBrF7Z3qblMV1jl2iOI","level":3,"time":"2024-12-03T20:31:54+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES)","userAgent":"--","version":"30.0.1.2","exception":{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES)","Code":1045,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1655,"function":"connect","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":866,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php","line":321,"function":"quote","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php","line":406,"function":"literal","class":"Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":328,"function":"literal","class":"OC\\DB\\QueryBuilder\\ExpressionBuilder\\ExpressionBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/BackgroundJob/JobList.php","line":318,"function":"unlockJob","class":"OC\\BackgroundJob\\JobList","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":196,"function":"setLastJob","class":"OC\\BackgroundJob\\JobList","type":"->"}],"File":"/var/www/nextcloud/lib/private/DB/Connection.php","Line":233,"message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES)","exception":{},"CustomMessage":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES)"}}

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

IMHO, not Web interface per se but something to do with server name authentication, I believe but have zero knowledge on how to proceed.

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

Only the first few records are listed here: (of course, I don't have a fully authenticated SSL, as yet, since port 80/443 traffic is directed to another server that has Let's Encrypt SSL certificates - renewed automatically; off topic perhaps, I understand)

$ cat ./error.log
[Thu Dec 05 00:00:02.145693 2024] [ssl:warn] [pid 2067:tid 2067] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Thu Dec 05 00:00:02.147205 2024] [ssl:error] [pid 2067:tid 2067] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=runner-e77zxf6b-project-66-concurrent-3 / issuer: CN=runner-e77zxf6b-project-66-concurrent-3 / serial: 4405C8DEA9002522FD1465647A0FC909C2E1AD82 / notbefore: Nov 19 13:35:46 2024 GMT / notafter: Nov 17 13:35:46 2034 GMT]
[Thu Dec 05 00:00:02.147240 2024] [ssl:error] [pid 2067:tid 2067] AH02604: Unable to configure certificate localhost:4443:0 for stapling
[Thu Dec 05 00:00:02.156931 2024] [mpm_event:notice] [pid 2067:tid 2067] AH00489: Apache/2.4.62 (Debian) OpenSSL/3.0.15 configured -- resuming normal operations
[Thu Dec 05 00:00:02.156988 2024] [core:notice] [pid 2067:tid 2067] AH00094: Command line: '/usr/sbin/apache2'
[Thu Dec 05 06:12:41.185303 2024] [mpm_event:notice] [pid 2067:tid 2067] AH00492: caught SIGWINCH, shutting down gracefully

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

/var/www/nextcloud/config/config.php
  'trusted_domains' => 
  array (
    0 => 'localhost',
    7 => 'nextcloudpi',
    5 => 'nextcloudpi.local',
    8 => 'nextcloudpi.lan',
    3 => 'raspberry2.domain.com',
    11 => '74.125.225.118',
    1 => '192.168.0.201',
    14 => 'raspberry2',
    2 => '',
  ),

Apps

The output of occ app:list (if possible).
??? What are the steps to obtain the output???

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

I have this problem too. EDIT: After much searching, it appears to be a bug in NCP. The workaround is to just not use that button.

Hello, @treesMcGees!

Sincerely, good advice. I understand, after doing some digging on CORS, that I need to stop digging.

Since I had done minimal customization during installation, I thought that my fat-fingering may have caused this issue and that it could be easily remedied with feedback from the community.

Regards.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.