Migrate to Secure Images #1718

Closed
opened 2026-02-05 01:42:19 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @mikeyz24 on GitHub (May 6, 2020).

I followed the instructions in the doc for Securing Images but after making the changes any images I upload as a cover page or part of page content are not showing up.

I can confirm that the image file is being saved to the storage/uploads/images folder and it has the correct permissions and ownership.

When looking at the source code of a page for example, the link that is being saved for the image is in this format: <a href="http://bookstack/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png">

Taking a look inside the DB in the IMAGES table, the entry for this image looks as follows:

id: 134
name: image-1588789464792.png
url: http://bookstack/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png
created_at: 2020-05-06 14:24:25
updated_at: 2020-05-06 14:24:25
created_by: 3
updated_by: 3
path: /uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png
type: gallery
uploaded_to: 83

If I try to visit the link http://bookstack/storage/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png I get a 404 error. What should the correct path be with Secure Images setting enabled? Do i have to make some changes in the NGINX config file to point it at the correct location or is this a bug?

Originally created by @mikeyz24 on GitHub (May 6, 2020). I followed the instructions in the doc for Securing Images but after making the changes any images I upload as a cover page or part of page content are not showing up. I can confirm that the image file is being saved to the storage/uploads/images folder and it has the correct permissions and ownership. When looking at the source code of a page for example, the link that is being saved for the image is in this format: `<a href="http://bookstack/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png">` Taking a look inside the DB in the IMAGES table, the entry for this image looks as follows: ``` id: 134 name: image-1588789464792.png url: http://bookstack/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png created_at: 2020-05-06 14:24:25 updated_at: 2020-05-06 14:24:25 created_by: 3 updated_by: 3 path: /uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png type: gallery uploaded_to: 83 ``` If I try to visit the link `http://bookstack/storage/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png` I get a 404 error. What should the correct path be with Secure Images setting enabled? Do i have to make some changes in the NGINX config file to point it at the correct location or is this a bug?
OVERLORD added the 🐕 Support label 2026-02-05 01:42:19 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Dec 17, 2020):

Hi @mikeyz24,

Sorry for my lack of response here. The image links themselves should remain the same after changing to STORAGE_TYPE=local_secure. Requests for these should automatically get routed through the application as long as a matching file does not exist in the public folder.

If I try to visit the link http://bookstack/storage/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png I get a 404 error.

That's what I'd expect since no image links should have storage in the path. I'd need to know what you'd get if visiting http://bookstack/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png directly while logged in.

@ssddanbrown commented on GitHub (Dec 17, 2020): Hi @mikeyz24, Sorry for my lack of response here. The image links themselves should remain the same after changing to `STORAGE_TYPE=local_secure`. Requests for these should automatically get routed through the application as long as a matching file does not exist in the `public` folder. > If I try to visit the link http://bookstack/storage/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png I get a 404 error. That's what I'd expect since no image links should have `storage` in the path. I'd need to know what you'd get if visiting `http://bookstack/uploads/images/gallery/2020-05/lU9FrfnU0EtFr4PR-image-1588789464792.png` directly while logged in.
Author
Owner

@ssddanbrown commented on GitHub (Jan 26, 2021):

Since there's been no further follow-up I'll close this off.

@ssddanbrown commented on GitHub (Jan 26, 2021): Since there's been no further follow-up I'll close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1718