Moving Discourse to subdirectory caused all uploads to break

(Staticinvocation) #1

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.

You can view the site here: Platinum Cheats Community. It was moved from

Anyone know what the deal is/how to fix? I understand that subdirectories are now officially supported in Discourse.

(Staticinvocation) #2

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)

(Jeff Atwood) #3

Did you check our topics in the howto category on subfolder?

(Staticinvocation) #4

I did. In the OP I stated I followed this howto:

(Jeff Atwood) #5

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.

(Staticinvocation) #6

Does the howto therefore assume a clean Discourse installation (e.g. not a rebuild)?

(Staticinvocation) #7

So I did a fresh install and restored from a backup. Everything is working perfectly now.

(Neil Lalonde) #8

I don’t know why new uploads would have been failing…

To fix existing uploads you need to run the remap tool. Something like this:

bundle exec script/discourse remap '/uploads' '/forum/uploads'

(Jeff Atwood) #9

And remap tool is covered in the existing howtos?

(Neil Lalonde) #10

Of course it is (because I just added it). The last section of this post mentions it.