save-draft and template load fails as it tries to use HTTP on HTTPS website - #1728

Closed
opened 2026-02-05 01:43:23 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @jspatel on GitHub (May 11, 2020).

Describe the bug
I have bookstackapp running as a docker container behind traefik.
My site is running as HTTPS and HTTP is not available. The app works great except on the page draft area.

Steps To Reproduce

  • Not sure if I have the exact steps to reproduce it.

Expected behavior
automatic draft should use the correct base-url using https instead of http.

Screenshots
Following are chrome console logs.

Mixed Content: The page at 'https://bookstack.example.com/books/test/page/chapter1/edit' was loaded over HTTPS, but requested an insecure resource 'http://bookstack.example.com/ajax/tags/get/page/43'. This request has been blocked; the content must be served over HTTPS.
<meta name="base-url" content="http://bookstack.example.com">
<link rel="stylesheet" href="https://bookstack.example.com/dist/styles.css?version=v0.29.0">
<link rel="stylesheet" media="print" href="https://bookstack.example.com/dist/print-styles.css?version=v0.29.0">

Notice the http instead of https

Your Configuration (please complete the following information):

  • 0.29.0
  • Bookstack as a docker container served via traefik

Additional context

  • I tried to set custom HTML Head Content with appropriate meta tag + base-url. This does show up on the page, however it doesn't override the built in meta tag with base-url value.

I searched in the container code base and saw following. Just wanted to add that, but don't know much about PHP.

./html/resources/views/base.blade.php:    <meta name="base-url" content="{{ url('/') }}">
./html/storage/framework/views/b5aa282065255104ebf4e35977af69c98b3f7190.php:    <meta name="base-url" content="<?php echo e(url('/')); ?>">

Additional note, this also cause the same error when try to apply a template on a page.

Originally created by @jspatel on GitHub (May 11, 2020). **Describe the bug** I have bookstackapp running as a docker container behind traefik. My site is running as HTTPS and HTTP is not available. The app works great except on the page draft area. **Steps To Reproduce** - Not sure if I have the exact steps to reproduce it. **Expected behavior** automatic draft should use the correct base-url using https instead of http. **Screenshots** Following are chrome console logs. ``` Mixed Content: The page at 'https://bookstack.example.com/books/test/page/chapter1/edit' was loaded over HTTPS, but requested an insecure resource 'http://bookstack.example.com/ajax/tags/get/page/43'. This request has been blocked; the content must be served over HTTPS. ``` ```html <meta name="base-url" content="http://bookstack.example.com"> <link rel="stylesheet" href="https://bookstack.example.com/dist/styles.css?version=v0.29.0"> <link rel="stylesheet" media="print" href="https://bookstack.example.com/dist/print-styles.css?version=v0.29.0"> ``` Notice the __http__ instead of __https__ **Your Configuration (please complete the following information):** - 0.29.0 - Bookstack as a docker container served via traefik **Additional context** - I tried to set custom HTML Head Content with appropriate meta tag + base-url. This does show up on the page, however it doesn't override the built in meta tag with base-url value. I searched in the container code base and saw following. Just wanted to add that, but don't know much about PHP. ``` ./html/resources/views/base.blade.php: <meta name="base-url" content="{{ url('/') }}"> ./html/storage/framework/views/b5aa282065255104ebf4e35977af69c98b3f7190.php: <meta name="base-url" content="<?php echo e(url('/')); ?>"> ``` ## Additional note, this also cause the same error when try to apply a template on a page.
Author
Owner

@jspatel commented on GitHub (May 11, 2020):

My absolutely hacky workaround is to use the tampermoneky with following script.

// ==UserScript==
// @name         Bookstack base-url fixer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Fix the bookstack base-url
// @author       Jigar 
// @match        https://bookstack.example.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    document.getElementsByName("base-url")[0].setAttribute("content","https://bookstack.example.com");
})();
@jspatel commented on GitHub (May 11, 2020): My absolutely hacky workaround is to use the tampermoneky with following script. ```JavaScript // ==UserScript== // @name Bookstack base-url fixer // @namespace http://tampermonkey.net/ // @version 0.1 // @description Fix the bookstack base-url // @author Jigar // @match https://bookstack.example.com/* // @grant none // ==/UserScript== (function() { 'use strict'; document.getElementsByName("base-url")[0].setAttribute("content","https://bookstack.example.com"); })(); ```
Author
Owner

@ssddanbrown commented on GitHub (May 11, 2020):

Hi @jspatel, Setting the APP_URL .env parameter should prevent this issue from occurring, Do you have an APP_URL option set?

@ssddanbrown commented on GitHub (May 11, 2020): Hi @jspatel, Setting the `APP_URL` .env parameter should prevent this issue from occurring, Do you have an `APP_URL` option set?
Author
Owner

@jspatel commented on GitHub (May 11, 2020):

No I don't have APP_URL option set. After setting that it started working again. I guess I didn't read ALL instructions 😢 for setting up the environment using reverse proxy.

BookStackApp Docker Hub page with instructions

@jspatel commented on GitHub (May 11, 2020): No I don't have APP_URL option set. After setting that it started working again. I guess I didn't read __ALL__ instructions :cry: for setting up the environment using reverse proxy. [BookStackApp Docker Hub page with instructions](https://hub.docker.com/r/linuxserver/bookstack)
Author
Owner

@ssddanbrown commented on GitHub (May 12, 2020):

@jspatel Glad that sorted it. Thanks nonetheless for providing such complete report in addition to sharing a workaround.

@ssddanbrown commented on GitHub (May 12, 2020): @jspatel Glad that sorted it. Thanks nonetheless for providing such complete report in addition to sharing a workaround.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1728