Sorl-Thumbnail returns error: "SuspiciousOperation: Attempted access to '/media/products/505.jpg' denied"

Feb 06, 2014 · Updated: Jul 05, 2021 · by Tim Kamanin

When Solr Thumbnail ( returns and error like "SuspiciousOperation: Attempted access to '/media/products/505.jpg' denied" or Bad request: 400 you need to check the path of the image you want to resize: it shouldn't start with your MEDIA_ROOT like ** '/media/products/505.jpg'**.

If you look into the database, you'll see that the path may be saved here as '/media/products/505.jpg' *where *' /media/' is MEDIA_ROOT. It shouldn't be like that, the path should be saved as ' products/505.jpg' instead which is a correct way to save image/file path into the database. Some modules like django-ajaximage have such a problem. Be aware of that.

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓