Closed aujawindar closed 1 year ago
This is caused by the X-Content-Type-Options: nosniff
HTTP header.
Nicely spotted. Is there anything to do about this? I understand that the nosniff HTTP header is a security feature that most browsers use. This is consistent with my experience, as the Mastodon web front-end doesn't load in any browser I've tried.
It's actually implemented in the YunoHost core :/ https://github.com/YunoHost/yunohost/blob/dev/conf/nginx/security.conf.inc#L33
Thanks for your help. You are good at finding things that I am not :) But the question remains: Is there a way to solve this specific userland problem?
If there are reasonable reasons to remove this header, couldnt we just override it with a more_set_headers
inside Mastodon's nginx conf ?
(Assuming this is the right way to address the issue)
Ah, yes, but we'll need to do a more_clear_headers
before more_set_headers
the to remove the first one.
Ah, this error was a symptom and not the cause...
Looks like assets are either not accessible or not compiled ?
Can you share the result of ls -lah /var/www/mastodon/live/public/packs/css/
? The file default-525fdc56.chunk.css
should be present. If not you could try to rebuild the assets with this command :
(cd /var/www/mastodon/live && sudo -u mastodon RAILS_ENV=production PATH=/opt/rbenv/versions/mastodon/bin bundle exec rails assets:precompile)
We also want to check ownership and permissions. The owner should be mastodon
.
ls -lah /var/www/mastodon/live/public/packs/css/
gives
drwxr-x--- 2 mastodon www-data 4,0K sep. 20 20:39 .
drwxr-x--- 6 mastodon www-data 4,0K juni 16 00:05 ..
-rw-r----- 1 mastodon www-data 7,0K juni 16 00:05 common-50d0784d.css.gz
-rw-r----- 1 mastodon www-data 8,3K juni 16 00:05 common-50d0784d.css.map.gz
-rw-r----- 1 mastodon www-data 76K juni 16 00:05 contrast-770a4110.chunk.css.gz
-rw-r----- 1 mastodon www-data 172K juni 16 00:05 contrast-770a4110.chunk.css.map.gz
-rw-r----- 1 mastodon www-data 75K juni 16 00:05 default-525fdc56.chunk.css.gz
-rw-r----- 1 mastodon www-data 171K juni 16 00:05 default-525fdc56.chunk.css.map.gz
-rw-r----- 1 mastodon www-data 2,4K juni 16 00:05 mailer-a549806c.chunk.css.gz
-rw-r----- 1 mastodon www-data 15K juni 16 00:05 mailer-a549806c.chunk.css.map
-rw-r----- 1 mastodon www-data 3,8K juni 16 00:05 mailer-a549806c.chunk.css.map.gz
-rw-r----- 1 mastodon www-data 78K juni 16 00:05 mastodon-light-05150082.chunk.css.gz
-rw-r----- 1 mastodon www-data 878K juni 16 00:05 mastodon-light-05150082.chunk.css.map
-rw-r----- 1 mastodon www-data 178K juni 16 00:05 mastodon-light-05150082.chunk.css.map.gz
This means that the files are present, but as gzips?
(cd /var/www/mastodon/live && sudo -u mastodon RAILS_ENV=production PATH=/opt/rbenv/versions/mastodon/bin bundle exec rails assets:precompile)
gives bundle: command not found
. Small typo, probably, but I am unable to see what the command should be. Thanks for your help so far.
I have to note that I've done no changes to any Mastodon files. This is a vanilla install.
it should be (cd /var/www/mastodon/live && sudo -u mastodon RAILS_ENV=production PATH=/opt/rbenv/versions/mastodon/bin bin/bundle exec rails assets:precompile)
Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install
Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
Exiting!
I am pretty sure Mastodon was installed through Yarn commands. Also, Yarn and nodejs are already installed on the server.
To be more precise:
# apt show yarn
Package: yarn
Version: 1.22.19-1
# apt show nodejs
Package: nodejs
Version: 12.22.12~dfsg-1~deb11u1
I can't see what's the reason for the rails command to fail with the errors above.
I get the same error with that command.
I checked and yarn path is in PATH, but when I wanted to check the version:
$ yarn -V
yarn install v1.22.19
[1/6] Validating package.json...
error @mastodon/mastodon@: The engine "node" is incompatible with this module. Expected version ">=12". Got "6.17.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I should add that this problem was introduced in an update to Mastodon on Yunohost. I can't tell exactly which version introduced the problem, but it was introduced some months ago. Sorry I can't be more specific. The comments to this issue seem to point at problems in the build process.
I can confirm that. Stopped working after some update. I did not notice that immediately, as usage via Mastodon clients (e.g. the official Android client) still works. Just the web-frontend broke.
Actualy https://github.com/mastodon/mastodon/issues/11600 is not really related to current problem as i thought initialy.
in fact might just be that multiple node versions are installed. In my case Expected version ">=12". Got "8.17.0"
ls -la /usr/local/bin/node -rwxr-xr-x 1 root staff 35028569 11 nov. 06:25 /usr/local/bin/node
/usr/local/bin/node --version v8.17.0
this file does not belong from any package ...
My node version is 16.18.1
/usr/local/bin/node --version
v16.18.1
using PATH=$PATH:/opt/rbenv/versions/mastodon/bin allows to keep access to nodejs, this was the original problem of script .
cd /var/www/mastodon/live && sudo -u mastodon RAILS_ENV=production PATH=$PATH:/opt/rbenv/versions/mastodon/bin
bin/bundle exec rails assets:precompile
yarn install v1.22.19
[1/6] Validating package.json...
[2/6] Resolving packages...
success Already up-to-date.
Done in 2.00s.
But still not working.
in last resort i did gunzip on directory and restarted mastodon-web
cd /var/www/mastodon/live/public/packs/css/
for i in *.*.gz; do gunzip $i; done
and for css, js media/fonts media/images ocr ... Seems better now ...
So is this the recommended way to fix this now? Or can we expect an update where this issue is fixed? I don't want to break it even more.
@jwgn i don't have any ground to recommend anything, i just share my way to have it back and running on a production system; i am not working on a fix.
I know. This was more of an indirect question to the maintainers of the package :)
So... what do we do now here?
Issue seems to be fixed with the 4.0.2~ynh1 update. Everything is working again.
I can confirm. The Yunohost update to Mastodon v4 has fixed the issue for me.
Describe the bug
As two different reports on forum.yunohost.org show, the Mastodon web client shows a blank page and cannot be used. Example here. The page source states that Javascript should be enabled, which it is.
Context
Steps to reproduce
Expected behavior
Using the web front-end should return the login page or the Yunohost SSO login page. Being logged in either way should enable using the Mastodon web front-end.