Skip to content

Attachment Links do not Use APP_URL #5896

@Bravehartk2

Description

@Bravehartk2

Describe the Bug

When switching domains or from a local domain to a public domain via proxy, attachments and uploaded images for the logo etc. are referenced by the old local hostname they where uploaded from instead using the APP_URL environment variable as it would be expected.
Hence you'll. get mixed content in the browser and it's not possible to download attachements if the original url was not public available.
The links should be dynamic or relativ to make sure, the files can be served even, if the domain changes.

After reuploading the attachments / logo images, the resource can be loaded. But thats not an option for all attachments for an instance that is used for years with hundreds of attachments.

Steps to Reproduce

  1. use a local domain or hostname
  2. upload logo or icon in the settings
  3. attach files to a page
  4. address the host via an public URL (I additionally had to use a proxy, hence I run it on HomeAssistant inside my internal network)
  5. set the APP_URL to the public domain in the .env file
  6. Open the page in Browser and see http request in developer toolbar => mixed content error + old url for requesting the files
  7. try to download an attachment => fails due to old, not accessible domain is used

Expected Behaviour

I would expect the application to use the APP_URL as prefix for all generated URLs and not saving the domain that was used to upload the image / attachment at all. Or analog wordpress there should be a replacement command or interface, where the URLs in the DB can be replaced. Or the URLs should always be relative or generated in the form "BASE_URL/REL_PATH_FROM_DB".

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

3.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions