Recently, one of the Discourse instances I’m maintaining migrated from being a standalone installation to being a multisite tenant, through backup-and-restore on a new host. In this process, the hostname also changed to a subdomain of the original one.
During this process, something went wrong with the attachments. While old images load fine, non-image attachments seem to be broken.
One of the broken files is linked in the post as
https://ws1617.■■■■■.■■■■■/uploads/prog1-ws1617/original/1X/3e5103b67bd6911bda0666be6d1aecb615f6ce38.exe. (This is the correct new hostname.)
Visiting this URL, while being logged in as an admin, yields a
However, the file does exist in the file system, at the expected path
/var/discourse/shared/standalone# ls -al uploads/prog1-ws1617/original/1X/3e5103b67bd6911bda0666be6d1aecb615f6ce38.exe.
The file also seems to have a healthy record in the
The Rails log file states that this is a problem of no route matching:
[prog1-ws1617] Started GET "/uploads/prog1-ws1617/original/1X/3e5103b67bd6911bda0666be6d1aecb615f6ce38.exe" for ■■■.■■■.■■.■■■ at 2017-07-29 12:24:24 +0000 [prog1-ws1617] ActionController::RoutingError (No route matches [GET] "/uploads/prog1-ws1617/original/1X/3e5103b67bd6911bda0666be6d1aecb615f6ce38.exe") /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' [prog1-ws1617] Processing by ExceptionsController#not_found as HTML [prog1-ws1617] Rendered exceptions/not_found.html.erb within layouts/no_ember (34.0ms) [prog1-ws1617] Rendered layouts/_head.html.erb (0.4ms) [prog1-ws1617] Rendered common/_special_font_face.html.erb (0.3ms) [prog1-ws1617] Rendered common/_discourse_stylesheet.html.erb (0.3ms) [prog1-ws1617] Rendered application/_header.html.erb (0.1ms) [prog1-ws1617] Rendered html template (0.0ms) [prog1-ws1617] Completed 404 Not Found in 64ms (Views: 0.5ms | ActiveRecord: 24.5ms)
What could be going on here?