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

fix(admin): Add a note about JavaScript modules to Nextcloud 28 upgrade guides #11471

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jan 26, 2024

☑️ Resolves

🖼️ Screenshots

image

…de guides

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
Copy link
Contributor Author

susnux commented Jan 26, 2024

/backport to stable28

@MichaIng
Copy link
Member

MichaIng commented Jan 26, 2024

At least on Debian, the MIME type is added automatically for all webservers, with their own configs or /etc/mime.types, so this part is probably less important. However, in which case and which absolute directory are you expecting conf/mime.types? Like this, me, and hence I guess many others, won't be able to know what to do, if the correct MIME type is really not served anyway. Not sure whether /etc/mime.types is used across all (relevant) distros and webservers, but this is probably a more clear config to look at? For Apache otherwise /etc/apache2/mods-available/mime.conf, or of course any other server/vhost config.

Just checked back: Nginx uses /etc/nginx/mime.types, Apache and Lighttpd use /etc/mime.types.

What I was actually missing in the docs was not the MIME type (still good to mention it), but the rewrites: The default/example webserver configs rewrite everything to index.php, which is not explicitly excluded from the rewrite, via RewriteCond in Apache, and location ~ \.(?:...|mjs|...) { block in Nginx.

Another thing is the Cache-Control header. So basically 3 things:

  1. Assure that requests to .mjs are not rewritten to index.php but served directly.
  2. Assure that .mjs files are served with text/javascript MIME type.
  3. Serve .mjs files with Cache-Control "max-age=15778463" header, like other static assets, respectively Cache-Control "max-age=15778463, immutable" for those with v= query parameter.

All of this can be usually achieved by adding mjs to the list(s) of asset file extensions in the existing Nextcloud webserver config.

Copy link
Contributor

github-actions bot commented May 2, 2024

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add mjs to upgrade guide for admins
3 participants