-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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]: Error in Checking JavaScript Support for .mjs Files in Nextcloud Behind Reverse Proxy #43757
Comments
You closed this so not sure if you were looking for something else here then figured it out or what, but for what it's worth:
I presume none of your other listed |
Yes, indeed, it was a DNS resolution issue that was causing the problem. I had named my backend machine as cloud.mydomain.com, but in reality, cloud.mydomain.com points to the HAProxy from the outside. As a result, tests targeting cloud.mydomain.com were not routed through HAProxy but were directly reaching the machine named cloud.mydomain.com. Changing the backend name to cloudbackend.mydomain.com, therefore, resolves the issue. When I wrote the initial message, I found it somewhat abnormal that Nextcloud wasn't performing the tests via HTTP, considering it should be aware of being behind a proxy. However, upon reflection, this behavior/bug now seems normal to me, which is why I closed the bug report. Hopefully, this information might help someone in the future... |
I see this issue is closed for several months, so perhaps should I open a new one ? As I meet the same problem (apache instance behind a nginx reverse proxy), I wonder if the way Nextcloud tests itself is pertinent : Nextcloud reports a warning because the test fails, but apache does support .mjs files well. For me, having to modify a working configuration only to suppress a warning message is abnormal. |
No answer is an answer. Let's open a new issue. |
Bug description
I encountered an issue with Nextcloud running behind a HAProxy reverse proxy, where it displayed an error message: "Could not check for JavaScript support. Please check manually if your web server serves .mjs files using the JavaScript MIME type."
This problem was manifesting due to Nextcloud's internal mechanism for verifying JavaScript support for .mjs files. In my configuration, Nextcloud was served by an Apache server, which communicated internally using HTTP. Externally, HAProxy was configured to handle HTTPS connections and forward these requests to the Apache server.
The issue was particularly perplexing as direct HTTP access to the .mjs test file (using curl -I http://cloud.mydomain.com/apps/settings/js/esm-test.mjs) worked correctly, serving the file with the appropriate JavaScript MIME type. However, Nextcloud's internal check, seemingly performed over HTTPS, led to the test failure. It appeared that Nextcloud was not correctly interpreting the reverse proxy setup, especially with internal server communication over HTTP and external access over HTTPS.
A critical factor in this configuration was the hostname of the Apache server, initially set to cloud.mydomain.com. This hostname seemed to contribute to the issue, likely causing Nextcloud to attempt internal resolution, thereby bypassing the HAProxy layer responsible for HTTPS.
Resolution:
The issue was successfully resolved by changing the hostname of the Apache server from cloud.mydomain.com to internal-cloud.mydomain.com. This modification ensured that internal requests within the server did not mistakenly bypass HAProxy, allowing Nextcloud to correctly interpret the environment and eliminating the error related to .mjs file JavaScript support checks. With this change, all functions in Nextcloud, including the handling of .mjs files, are operating correctly as intended in the HAProxy reverse proxy setup.
Reason for Reporting the Bug:
Despite resolving the issue through a hostname change, I am reporting this bug because I believe Nextcloud should be able to handle such scenarios without requiring a server hostname change. In an ideal setup, Nextcloud should be capable of accurately recognizing and adapting to environments where it is deployed behind a reverse proxy, regardless of the server's internal hostname. This bug report is aimed at improving Nextcloud's functionality in similar configurations and ensuring smoother operation in diverse network setups.
Steps to reproduce
1.Set up Nextcloud on an Apache server with the internal hostname cloud.mydomain.com.
2.Configure HAProxy as a reverse proxy to handle HTTPS, forwarding requests to the Apache server, which communicates internally using HTTP.
3.Access the Nextcloud instance through the proxy (https://cloud.mydomain.com) and navigate to the settings or admin panel.
4.Observe the error message concerning JavaScript support for .mjs files.
5.Test direct HTTP access to the .mjs file via curl -I http://cloud.mydomain.com/apps/settings/js/esm-test.mjs and confirm it serves correctly with the appropriate MIME type.
6.Note that due to the internal server hostname being cloud.mydomain.com, Nextcloud attempts to verify the .mjs file using HTTPS within the local network, bypassing HAProxy, and leading to the test failure.
Expected behavior
In an ideal setup, Nextcloud should correctly recognize and handle JavaScript file checks for .mjs files behind a reverse proxy without errors. The system should accurately detect the MIME type regardless of the server's internal hostname configuration.
Installation method
Community Manual installation with Archive
Nextcloud Server version
28
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
Additional info
No response
The text was updated successfully, but these errors were encountered: