[Solved] Public uploads go 404 after assets:precompile

Seems very strange, but after making changes to the templates and running assets:precompile in production, the assets under public/uploads return 404.

I’ve checked the location and the files are there:

# tree public/uploads

public/
└── uploads
    ├── custom_asset_file
    │   └── 1
    │       └── favicon.ico
    ├── machine_image
    │   ├── 2
    │   │   ├── large_machine_image.jpg
    │   │   ├── machine_image.jpg
    │   │   └── medium_machine_image.jpg

But the browser gets:

GET http://mydomain/uploads/machine_image/2/medium_machine_image.jpg 404 (Not Found)

I’ve searched similar problems with Rails and Carrierwave to no avail, so I suspect that the Nginx configuration may have something to do with it.

If I upload a new file to replace it, it is shown without problems so maybe Rails picks up a temporary file and serves it instead of the one created under uploads. But, doing this becomes burdensome as the number of uploaded images increase.

Any ideas?

Hi @akaiiro,

This may be related to your nginx configuration. Can you post here your configuration file, so that we can review it together?

Thanks @Sylvain . The problem seemed to be my docker-compose configuration. I upgraded it to the 3.6 version and the shared volumes syntax works a little different, so, the content from uploads was not being stored in the host. Then, the uploads were deleted when the container was turned off.