Booktype over HTTPS
  • Hello all

    I made a new attempt at installing and running Booktype 2.4, using the manual installation procedure (on a DigitalOcean droplet).  Seems to work fine, but it will not run properly over HTTPS.

    I can get the Letsencrypt certificate up and running no problem, but get mixed content warnings in both Firefox and Chrome, and many interface menu-icons will not show up when using HTTPS, thus it's almost impossible for ordinary users to figure out how to use Booktype. (They have to guess the functionality of a menu item button, and hope it does not destroy something)

    I see other people have similar problems using https with Superdesk.

    Why would a clean installation get mixed content warnings? And what could be the reason interface menu-icons not show up in https?
    Post edited by Graabein at 2019-03-17 07:59:54
  • 7 Comments sorted by
  • When viewing the website in https, and then hitting F12 in the browser to view the console, it is full of references to http:// urls collected from "CACHE", "static" and "data" directories.

    It seems like the installation process has created some static url references to http://, that ofcourse will not work when site is viewed in https://

    Do I have to rebuild the app after configuring the Letsencrypt certificate, or are there some settings I can change in or to get this to work properly?

    What to do?

    Attached is the log from the browser console.  This is what shows when visiting the site as guest, when logged in these results increase by a great number.
    Post edited by Graabein at 2019-03-17 15:11:12
  • OK, I editet

    Changed BOOKTYPE_URL to https://

    Then I ran
    ./ collectstatic

    ./ compress

    Then restarted server, cleared browser cache. Now mixed content errors are gone and it seems to work.

    However, now - after installing SSL certificate - exporting books don't work any longer, it just hangs there with a message saying "Exporting, please wait".  It did work as expected before I installed SSL.

    Here is what I found in booktype-celery.error.log, the only thing I found related to any export/publishing error

    [2019-03-18 23:35:23,818: ERROR/ForkPoolWorker-12] Task booktype.apps.edit.tasks.publish_book[b534fb3a-f862-4282-939f-da2fa6084414] raised unexpected: UnboundLocalError("local variable 'req' referen$
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/celery/app/", line 375, in trace_task
        R = retval = fun(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/celery/app/", line 632, in __protected_call__
        return*args, **kwargs)
      File "/usr/local/src/booktype/lib/booktype/apps/edit/", line 116, in publish_book
        result = download.fetch_url(convert_url, data, method='POST')
      File "/usr/local/src/booktype/lib/booktype/utils/", line 36, in fetch_url
        if req.status_code != 200:
    UnboundLocalError: local variable 'req' referenced before assignment

    Post edited by Graabein at 2019-03-18 19:28:05
  • Hi Graabein,

    What value do you have for `CONVERT_URL` in the
  • Hi Oleg


    and BOOKTYPE_URL says

    BOOKTYPE_URL = os.environ.get('BOOKTYPE_URL', 'https://domainnameeditedforprivacy.tld')

    Post edited by Graabein at 2019-03-19 09:54:32
  • Hi @oleg.pshenichniy, are you there?
    Post edited by Graabein at 2019-03-26 17:13:34
  • Vote Up0Vote Down GraabeinGraabein
    Posts: 94Member
    Is there anyone able to help me find a solution to the export problem?
  • Vote Up0Vote Down GraabeinGraabein
    Posts: 94Member
    This is a bit frustrating, have waited two months for some help.......maybe it would be better to rename this forum?