Images now pointing to "localhost" rather than domain #1545

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

Originally created by @andrefecto on GitHub (Feb 18, 2020).

Describe the bug
After updating Bookstack, all the links to any pages or images now point towards "localhost" rather than my domain. These links were working fine previously on this server + domain. However, I ran two updates this week to get on the current version of Bookstack and sometime in there, the links broke.

Steps To Reproduce
Steps to reproduce the behavior:
Unknown because I do not know which version specifically broke it.

Expected behavior
Links should link to URL defined in the .env file. I did verify that mine is set properly.

Screenshots
Here is what a link to one of my books looks like now:
image
Here is what an image looks like in the editor:
image
The link for that image is trying to point towards:
image

Your Configuration (please complete the following information):

Additional context
Looking back the release history here, I think I was running BookStack Beta v0.27.5 and then upgraded to BookStack Beta v0.28.0 about 5 or 6 days ago. Then when I saw BookStack Beta v0.28.1 and v0.28.2 get released, I updated this morning. That's when I noticed the images were broken.

Any help getting these images re-linked is appreciated.

Originally created by @andrefecto on GitHub (Feb 18, 2020). **Describe the bug** After updating Bookstack, all the links to any pages or images now point towards "localhost" rather than my domain. These links were working fine previously on this server + domain. However, I ran two updates this week to get on the current version of Bookstack and sometime in there, the links broke. **Steps To Reproduce** Steps to reproduce the behavior: Unknown because I do not know which version specifically broke it. **Expected behavior** Links should link to URL defined in the .env file. I did verify that mine is set properly. **Screenshots** Here is what a link to one of my books looks like now: ![image](https://user-images.githubusercontent.com/899058/74748162-50bc3280-5225-11ea-8e93-3f87dcb93a0c.png) Here is what an image looks like in the editor: ![image](https://user-images.githubusercontent.com/899058/74748725-3898e300-5226-11ea-81a1-fa5fa8b9be9f.png) The link for that image is trying to point towards: ![image](https://user-images.githubusercontent.com/899058/74748774-49495900-5226-11ea-8f91-29e48a74685b.png) **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): BookStack v0.28.2 - PHP Version: 7.3.14 - Hosting Method (Nginx/Apache/Docker): Docker, using https://github.com/linuxserver/docker-bookstack **Additional context** Looking back the release history here, I think I was running BookStack Beta v0.27.5 and then upgraded to BookStack Beta v0.28.0 about 5 or 6 days ago. Then when I saw BookStack Beta v0.28.1 and v0.28.2 get released, I updated this morning. That's when I noticed the images were broken. Any help getting these images re-linked is appreciated.
Author
Owner

@ssddanbrown commented on GitHub (Feb 18, 2020):

Hi @andrefecto,
Where are you defining the APP_URL value and are you specifying a full base URL (Including HTTP) are are you attempting to use a relative base URL (/) here?

Having localhost show like that generally suggests that the APP_URL is not being used for links so bookstack is defaulting to the URL it's being accessed on.

@ssddanbrown commented on GitHub (Feb 18, 2020): Hi @andrefecto, Where are you defining the `APP_URL` value and are you specifying a full base URL (Including HTTP) are are you attempting to use a relative base URL (`/`) here? Having localhost show like that generally suggests that the `APP_URL` is not being used for links so bookstack is defaulting to the URL it's being accessed on.
Author
Owner

@andrefecto commented on GitHub (Feb 18, 2020):

@ssddanbrown I rechecked my docker compose config and it looks like I forgot the APP_URL environment variable. However, previously when I was gathering information for this post I did look at my .env file and saw that the APP_URL was set correctly (it had my URL with https://). I added the APP_URL variable to my docker compose file, but the issue isn't fixed, even after a restart of the application.

@andrefecto commented on GitHub (Feb 18, 2020): @ssddanbrown I rechecked my docker compose config and it looks like I forgot the APP_URL environment variable. However, previously when I was gathering information for this post I did look at my .env file and saw that the APP_URL was set correctly (it had my URL with https://). I added the APP_URL variable to my docker compose file, but the issue isn't fixed, even after a restart of the application.
Author
Owner

@ssddanbrown commented on GitHub (Feb 19, 2020):

So, Just to confirm, do other links in the interface (books, settings page) work or is it just things like images?

@ssddanbrown commented on GitHub (Feb 19, 2020): So, Just to confirm, do other links in the interface (books, settings page) work or is it just things like images?
Author
Owner

@andrefecto commented on GitHub (Feb 19, 2020):

@ssddanbrown just from a preliminary check, all looks will with those types of links. Seems to just be things I've linked within a page.

EDIT: I think I figured out the issue and I'm sorry for wasting your time, kind of embarrassing. I originally had bookstack running locally when I was creating some documentation. I then uploaded it to my server and started running it from there. I think those links were created when I was running it locally. Really sorry about this...I just remembered that I did that, it was a while ago.

@andrefecto commented on GitHub (Feb 19, 2020): @ssddanbrown just from a preliminary check, all looks will with those types of links. Seems to just be things I've linked within a page. EDIT: I think I figured out the issue and I'm sorry for wasting your time, kind of embarrassing. I originally had bookstack running locally when I was creating some documentation. I then uploaded it to my server and started running it from there. I think those links were created when I was running it locally. Really sorry about this...I just remembered that I did that, it was a while ago.
Author
Owner

@ssddanbrown commented on GitHub (Feb 21, 2020):

@andrefecto No worries, thanks for letting me know.
You'll need to update those old links to be usable, If only a few you might be able to update the content in the interface otherwise it's possible to run some replace commands directly on the database to update such links.

I've assigned #1225 to the next feature release to make domain-switching easier in the future.

I'll close this since it sounds like it's solved but if you need any help feel free to open a new issue, referencing this one.

@ssddanbrown commented on GitHub (Feb 21, 2020): @andrefecto No worries, thanks for letting me know. You'll need to update those old links to be usable, If only a few you might be able to update the content in the interface otherwise it's possible to run some `replace` commands directly on the database to update such links. I've assigned #1225 to the next feature release to make domain-switching easier in the future. I'll close this since it sounds like it's solved but if you need any help feel free to open a new issue, referencing this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1545