Restore with Domain Change: Images Won't Load #2875

Closed
opened 2026-02-05 05:33:36 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @brandoningli on GitHub (Jun 26, 2022).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I am in the midst of scripting out the restoration of my VMs, and am running into a slight snag with restoring Bookstack regarding images. The files all copy over, database migrations don't run until after my sqldump is complete, and I've run the commands on the debugging page / generated output for changing the APP_URL. The URLs do change, but they will 404. I'm using the more secure image option. New uploads work fine.

The one thing I'm configuring differently is that my Apache config is redirecting all traffic to HTTPS, but otherwise the :443 virtual server configuration is identical to the default one on :80.

Exact BookStack Version

v22.03.1 -> v22.06.1

Log Content

No response

PHP Version

7.4

Hosting Environment

Ubuntu 20.04 VMs running on an ESXi server. Restore via custom Ansible playbook / tarball / SMB share.

Originally created by @brandoningli on GitHub (Jun 26, 2022). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I am in the midst of scripting out the restoration of my VMs, and am running into a slight snag with restoring Bookstack regarding images. The files all copy over, database migrations don't run until after my sqldump is complete, and I've run the commands on the debugging page / generated output for changing the APP_URL. The URLs do change, but they will 404. I'm using the more secure image option. New uploads work fine. The one thing I'm configuring differently is that my Apache config is redirecting all traffic to HTTPS, but otherwise the `:443` virtual server configuration is identical to the default one on `:80`. ### Exact BookStack Version v22.03.1 -> v22.06.1 ### Log Content _No response_ ### PHP Version 7.4 ### Hosting Environment Ubuntu 20.04 VMs running on an ESXi server. Restore via custom Ansible playbook / tarball / SMB share.
OVERLORD added the 🐕 Support label 2026-02-05 05:33:36 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jun 26, 2022):

Hi @brandoningli,
Just to confirm, are you running the php artisan bookstack:update-url <oldUrl> <newUrl> command as part of this process?

@ssddanbrown commented on GitHub (Jun 26, 2022): Hi @brandoningli, Just to confirm, are you running the `php artisan bookstack:update-url <oldUrl> <newUrl>` command as part of this process?
Author
Owner

@brandoningli commented on GitHub (Jun 26, 2022):

Yep! Running both

php artisan bookstack:update-url <old> <new>
php artisan cache:clear

The db itself is updated, and the new domain is used for the image URLs, but they 404.

@brandoningli commented on GitHub (Jun 26, 2022): Yep! Running both ``` php artisan bookstack:update-url <old> <new> php artisan cache:clear ``` The db itself is updated, and the new domain is used for the image URLs, but they 404.
Author
Owner

@ssddanbrown commented on GitHub (Jun 26, 2022):

Okay, When opening one of the non-working image URLs in the browser, what is the URL (Can obscure domain and file name as required) and what kind of 404 page is shown? A blank-looking page or a bookstack styled page?

@ssddanbrown commented on GitHub (Jun 26, 2022): Okay, When opening one of the non-working image URLs in the browser, what is the URL (Can obscure domain and file name as required) and what kind of 404 page is shown? A blank-looking page or a bookstack styled page?
Author
Owner

@brandoningli commented on GitHub (Jun 26, 2022):

The URLs are like https://testing.domain.com/uploads/images/gallery/2022-05/scaled-1680-/xIifzdM2mT2URWlY-tivo-mini-release-tuner.jpg, and I get a bookstack styled page.

Looking closer, though, and it looks like those images may not have actually copied over 🤦, so this may be an issue with my process instead of with bookstack. I'll work that kink out on my end and reopen if that doesn't solve things.

@brandoningli commented on GitHub (Jun 26, 2022): The URLs are like `https://testing.domain.com/uploads/images/gallery/2022-05/scaled-1680-/xIifzdM2mT2URWlY-tivo-mini-release-tuner.jpg`, and I get a bookstack styled page. Looking closer, though, and it looks like those images may not have actually copied over :facepalm:, so this may be an issue with my process instead of with bookstack. I'll work that kink out on my end and reopen if that doesn't solve things.
Author
Owner

@ssddanbrown commented on GitHub (Jun 26, 2022):

Alrighty, Good luck!

@ssddanbrown commented on GitHub (Jun 26, 2022): Alrighty, Good luck!
Author
Owner

@brandoningli commented on GitHub (Jun 26, 2022):

I've got the files copied over successfully now, but unfortunately the issue still persists. File permissions and directory contents look identical between the source and destination VMs.

@brandoningli commented on GitHub (Jun 26, 2022): I've got the files copied over successfully now, but unfortunately the issue still persists. File permissions and directory contents look identical between the source and destination VMs.
Author
Owner

@brandoningli commented on GitHub (Jun 26, 2022):

Actually, I take that back again. Sorry. It looks like storage got nested inside another storage directory.

@brandoningli commented on GitHub (Jun 26, 2022): Actually, I take that back again. Sorry. It looks like `storage` got nested inside another `storage` directory.
Author
Owner

@brandoningli commented on GitHub (Jun 26, 2022):

That was exactly my issue. I had an errant trailing slash which was causing my copy to be nested into a same-name subdirectory instead of the directory I wanted it in.

@brandoningli commented on GitHub (Jun 26, 2022): That was exactly my issue. I had an errant trailing slash which was causing my copy to be nested into a same-name subdirectory instead of the directory I wanted it in.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2875