fix(admin): Add a note about JavaScript modules to Nextcloud 28 upgrade guides
☑️ Resolves
- Fix https://github.com/nextcloud/documentation/issues/11429
🖼️ Screenshots
/backport to stable28
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:
- Assure that requests to
.mjsare not rewritten toindex.phpbut served directly. - Assure that
.mjsfiles are served withtext/javascriptMIME type. - Serve
.mjsfiles withCache-Control "max-age=15778463"header, like other static assets, respectivelyCache-Control "max-age=15778463, immutable"for those withv=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.
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!
@MichaIng Nice summary. Do we need to do anything else here or is this PR sufficient?
@st3iny None of the points I listed are addressed in this PR yet 😉. Let me do a concrete suggestion.
/backport to stable29
I merged the pr to finally get it in.
@MichaIng would you mind shooting a follow-up with your suggestions?
@kesselb Done: #11912