Nextcloud error with nginx as a reverse proxy

Dear friends ,
I have a nginx reverse proxy in front of my nextcloud server.
The nginx dispatches the requests to several applications, to several servers.
Nginx and Nextcloud are on different servers.

Nginx has a htpasswd based access control for the other apps but not for Nextcloud (as Nextcloud does not like it ! ).

Sometimes when the user browse from the other apps to Nextcloud he gets a blue page from Nextcloud with the message “Error”.

At this time nextcloud.log says : “message”:“Token is not valid: Token is too short for a generated token, should be the password during basic auth”

This beahaviour is very reproductive since a few years ago after a release (I dont remember wich one) .

Have I to add specific instructions to the Nextcloud section in my Nginx configuration ?

How may I recover peaceful relation between Nginx and Nextcloud ?

Versions :
*Nginx server:
Debian 12.8
Nginx: 1.22.1-9 (standard debian)

Nextcloud server
Debian 12.8
Apache2 2.4.62-1~deb12u2
Mariadb 1:10.11.6-0+deb12u1
php8.2 8.2.26-1~deb12u1
[Nextcloud Hub 9] (30.0.2)

From admin account:
Type : mysql
Version : 10.11.6
Taille : 24,5 MB
Version : 8.2.26
Limite de mémoire : 128 MB
Temps d’exécution maximal : 3600
Taille de téléversement maximale : 2 MB
Fréquence de revalidation de l’OPcache : 2
Extensions : Core, date, libxml, openssl, pcre, zlib, filter, hash, json, random, Reflection, SPL, session, standard, sodium, apache2handler, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, imap, intl, exif, msgpack, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, memcached, Zend OPcache

Browser Firefox 133.0.3

Many thanks for infos

Jlem

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):
    • replace me
  • Operating system and version (e.g., Ubuntu 24.04):
    • replace me
  • Web server and version (e.g, Apache 2.4.25):
    • replace me
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me
  • PHP version (e.g, 8.3):
    • replace me
  • Is this the first time you’ve seen this error? (Yes / No):
    • replace me
  • When did this problem seem to first start?
    • replace me
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • replace me
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • replace me

Summary of the issue you are facing:

[…]

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

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.

PASTE HERE

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.

PASTE

Web server / Reverse Proxy

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

PASTE HERE

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!):

PASTE HERE

Apps

The output of occ app:list (if possible).

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.

Nginx has a htpasswd based access control for the other apps but not for Nextcloud (as Nextcloud does not like it ! ).

Correct. Nextcloud uses Basic Authentication itself so this would be an incompatible combination.

At this time nextcloud.log says : “message”:“Token is not valid: Token is too short for a generated token, should be the password during basic auth”

For future reference: Please include the entire log entry (raw entry; it’ll have a stack trace). Otherwise it’s challenging to sort out what code path is getting you there.

However, given you’re using htaccess / basic auth under other folders at the same URL, my guess is that’s the culprit here.

You’ll need to make sure the auth is off (at the Nginx level in your case it sounds like). There’s a small bulletpoint in the Additional Apache configurations section of the Admin Manual about this (the Satisfy Any reference).

I presume you’ll need a similar counterpart for Nginx, but I haven’t messed with Nginx’s htaccess support in years so I don’t know the parameters offhand.

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