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

[Bug]: JavaScript support detection broken on non-top level hosting #48106

Closed
5 of 8 tasks
BastienDurel opened this issue Sep 16, 2024 · 5 comments
Closed
5 of 8 tasks
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug

Comments

@BastienDurel
Copy link
Contributor

⚠️ This issue respects the following points: ⚠️

Bug description

Hello,

The mjs support detection does not seems to work when nextcloud is not hosted on the root of the domain (when it's in a subdirectory)

My instance is hosted in the /owncloud directory (I did not wanted to disrupt my users), but the test tries to connect to /owncloud/owncloud/apps/settings/js/esm-test.mjs

/var/log/apache2/access.log:10.126.0.42 - - [16/Sep/2024:12:41:26 +0200] me "HEAD /owncloud/owncloud/apps/settings/js/esm-test.mjs HTTP/1.1" 404 5678 "-" "Nextcloud Server Crawler"

This URL is invalid

I did not dig down very much, but at

$testFile = $this->urlGenerator->linkTo('settings', 'js/esm-test.mjs');
it seems to generate a complete URL, then at
[$this->urlGenerator->getAbsoluteURL($testFile)],
it generates it again, which may lead to double-adding the base directory

Steps to reproduce

  1. host nextcloud in a subdirectory
  2. go to settings/admin/overview

Expected behavior

no message "Unable to run check for JavaScript support."

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 28 to 29)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "30.0.0.14",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "forcessl": true,
        "theme": "",
        "debug": false,
        "maintenance": false,
        "default_phone_region": "FR",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "secret": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "loglevel": 1,
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "trashbin_retention_obligation": "auto",
        "updatechecker": false,
        "htaccess.RewriteBase": "\/owncloud",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "mysql.utf8mb4": false,
        "mail_smtpmode": "sendmail",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "maintenance_window_start": 3,
        "check_for_working_wellknown_setup": false
    }
}

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@BastienDurel BastienDurel added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Sep 16, 2024
@BastienDurel
Copy link
Contributor Author

BastienDurel commented Sep 16, 2024

NB: this also breaks the JavaScriptSourceMaps check

NB2: One can workaround by adding a link : ln -s . owncloud but it's dirty ;)

NB3: OCA\Settings\SetupChecks\SecurityHeaders seems to be affected too, as I get this in apache logs :

/var/log/apache2/access.log:10.126.0.42 - - [16/Sep/2024:18:02:34 +0200] me "GET /owncloud/owncloud/heartbeat HTTP/1.1" 404 10566 "-" "Nextcloud Server Crawler"

But for this one, the link is ineffective as a workaround

@kesselb
Copy link
Contributor

kesselb commented Sep 16, 2024

Thanks for your report 👍

The problem is hopefully solved with 30.0.0.1 and 29.0.8 (both scheduled for 2024-10-10)

More details #47950

@kesselb kesselb closed this as completed Sep 16, 2024
@BastienDurel
Copy link
Contributor Author

Oups, sorry, I did not checked the closed bugs :$

@kesselb
Copy link
Contributor

kesselb commented Sep 16, 2024

Don't worry

@Gwyll
Copy link

Gwyll commented Oct 5, 2024

Hello,

Since we still have 5 days until 2024-10-10 here is a moderately dirty solution.
Add this to the vhost config:

RedirectMatch "^/(value of htaccess.RewriteBase)/(value of htaccess.RewriteBase)/(.*)" "/nextcloud/$3"

If
'htaccess.RewriteBase' => '/nextcloud',

then
RedirectMatch "^/(nextcloud)/(nextcloud)/(.*)" "/nextcloud/$3"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug
Projects
None yet
Development

No branches or pull requests

3 participants