staticinvocation moved their Discourse forum to a subdirectory using Varnish to share an EV cert between sites, but this broke all uploads — existing ones 404’d and new uploads failed silently. After checking logs, they found a routing error for /uploads.jsonstaticinvocation. codinghorror suggested reviewing existing subfolder howtos, which staticinvocation confirmed they followed. codinghorror noted the issue likely stems from moving to a subfolder after initial setup, meaning uploads remained in the old path, and asked for input from neil or zogstrip. staticinvocation questioned whether the guide assumes a clean install, then later reported success after a fresh install and restore from backup staticinvocation. neil explained that existing uploads require remapping via bundle exec script/discourse remap '/uploads' '/forum/uploads', and confirmed the remap tool is now documented in the howto’s final section neil. codinghorror suggested updating the howto to cover post-install subfolder moves.
I recently bought an EV cert for my domain and I wanted to use it on both my main site and my forum. To solve this, I followed this guide and moved it to a subdirectory using a Varnish configuration.
The only noticeable problem was that this broke all current and new uploads. Existing uploads 404 from nginx, and new uploads fail with no error in sideqik or the error log.
So poking around in the rails production log, I found this when uploading a file:
Started GET "/forum/uploads.json?client_id=xxx&authenticity_token=xxx" for xxx at 2015-08-27 02:15:10 +0000
ActionController::RoutingError (No route matches [GET] "/uploads.json")
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.10/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
Processing by ExceptionsController#not_found as JSON
Parameters: {"client_id"=>"xxx", "authenticity_token"=>"xxx"}
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.3ms)
Yeah looks like the issue is you changed to subfolder after the fact so all your uploads are in the old place. Any advice in this case @neil or @zogstrip?
Maybe we can update the howto so it covers this case as well.