Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-26-2017, 08:38 PM   #1
rutmang
Junior Member
rutmang began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2013
Device: Kindle Fire 8.9
ebook reader: blob error expecting text

Hello All,
I have performed an upgrade to 3.1.1 on an existing Ubuntu 16.04 server running calibre-server. Things look ok, and the reader works when I hit it locally by the IP address and the port.

But when I try to use it from Apache presenting it externally, the reader function throws an error:

Code:
Uncaught InvalidStateError: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'blob').
Error at calibre:4819:32
Traceback (most recent call last):
    at XMLHttpRequest.ρσ_anonfunc (https://xxxxx.net/calibre:4894:21)
    at complete_callback (https://xxxxx.net/calibre:4863:21)
    at set_error (https://xxxxx.net/calibre:4819:32)
Error: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'blob').
My calibre.service script:

Code:
[Unit]
Description=Calibre Service
After=network.target

[Service]
Type=forking
PIDFILE=/tmp/calibre-server.pid
ExecStart=/opt/calibre/calibre-server /media/usb1/media/calibrelibrary \
        --daemonize \
        --log=/var/log/calibre-server \
        --max-opds-items=30 \
        --max-opds-ungrouped-items=100 \
        --port=8088 \
        --pidfile=/tmp/calibre-server.pid \
        --url-prefix=/calibre
        --auth-mode=basic

[Install]
WantedBy=multi-user.target
The log is only showing:

Code:
calibre server listening on 0.0.0.0:8088
OPDS feeds advertised via BonJour at: 192.168.10.68 port: 8088
Externally, I can browse and download books from the webpage or through OPDS. When I try the Read button, it attempts the download sequence and then pops the error above.

I can only guess something with the new reader function doesn't like how I've had Apache set up for normal operation in the past. Any ideas would be helpful! Thank you!
rutmang is offline   Reply With Quote
Old 06-26-2017, 10:57 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Whatever forwarding rules you have setup for apache are mangling the URL, see similar discussion for nginx: https://bugs.launchpad.net/bugs/1700567
kovidgoyal is offline   Reply With Quote
Old 06-28-2017, 07:20 PM   #3
rutmang
Junior Member
rutmang began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2013
Device: Kindle Fire 8.9
Thanks for the quick response, Kovid. I've been working on this over a day on and off and haven't gotten anywhere. As to the link provided, I don't know enough about ngnix to translate the fix with that issue to apache. I've followed the apache rules stated in the manual and can browse the web pages and download books, so I can't understand why the rules aren't working for the reader function when they are working elsewhere (i am guessing its the appcache business). I am out of my depth.

Thanks in any case.
rutmang is offline   Reply With Quote
Old 06-28-2017, 11:36 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's because the URLs the book reader uses include characters such a / which need to be escaped. Probably the proxy config for apache will have to be modified to handle that. At some point I have to find the time to install apache and update the manual.
kovidgoyal is offline   Reply With Quote
Old 06-29-2017, 11:29 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I tried it with apache and it works fine for me with the following apache config:

Code:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so

    RewriteEngine on
    RewriteRule ^/calibre/(.*) http://127.0.0.1:8080/calibre/$1 [proxy]
    RedirectMatch permanent ^/calibre$ /calibre/
Which is what is in the manual.
kovidgoyal is offline   Reply With Quote
Old 06-29-2017, 01:52 PM   #6
rutmang
Junior Member
rutmang began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2013
Device: Kindle Fire 8.9
Yes, Kovid that is what I have in my config as well and unfortunately it doesn't work for me. There must be something elsewhere in the apache configuration that is causing the issue that I am unaware of and too ignorant to find. I couldn't expect you to look further if it is working for you as stated.

Thanks for your time and your excellent product.
rutmang is offline   Reply With Quote
Old 07-02-2017, 10:37 AM   #7
rutmang
Junior Member
rutmang began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2013
Device: Kindle Fire 8.9
Just following up, it looks like adding the line AllowEncodedSlashes On fixed the issue I was having with the escaping of slashes you mentioned.

Code:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so

AllowEncodedSlashes On
    RewriteEngine on
    RewriteRule ^/calibre/(.*) http://127.0.0.1:8088/calibre/$1 [proxy]
    RedirectMatch 301 ^/calibre$ "/calibre/"
I am running Apache/2.4.18 (Ubuntu) if that accounts for any differences in our results where you didn't have to add it while I did.

Thanks again for your help!
rutmang is offline   Reply With Quote
Old 07-02-2017, 10:52 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Glad you figured it out. I will add that directive to the Apache sections in the manual.
kovidgoyal is offline   Reply With Quote
Old 08-26-2017, 08:52 AM   #9
Bookaboy
Junior Member
Bookaboy began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Aug 2017
Device: Ubuntu Linu
Virtual Host

Hi,

Thanks for you instructions on Apache. I would like to post this virtualhost example, this could be of help as well for people who are struggling with Apache and Calibre.

This is hosted on a Apache 2.4 server, and an SSL certificate by LetsEncrypt is used as well, no virtual directory was used, however.

Code:
   <VirtualHost                 *:80>
        ServerName              books.example.org
        RewriteEngine           on
        RewriteCond             %{SERVER_PORT} ^80$
        RewriteRule             ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
   </VirtualHost>

   <VirtualHost                 *:443>
        SSLEngine               On
        SSLCertificateFile      /etc/letsencrypt/live/books.example.org/fullchain.pem
        SSLCertificateKeyFile   /etc/letsencrypt/live/books.example.org/privkey.pem
        Include                 /etc/letsencrypt/options-ssl-apache.conf

        ServerName              books.example.org
        AllowEncodedSlashes     On
        RewriteEngine           On
        RewriteRule             ^/(.*) http://127.0.0.1:8081/$1 [proxy]
        RedirectMatch           301 ^/$ "/"
   </VirtualHost>
Bookaboy is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Content FIRE size is zero for all books Error expecting data frontline Devices 1 12-03-2016 02:58 PM
Windows ebook reader with Text to Speech. rboatright General Discussions 7 08-08-2016 09:59 PM
Catalog: export cover as blob fxp33 Library Management 17 09-05-2015 04:45 AM
Copy plain text from ebook reader BetterRed Calibre 17 05-08-2013 05:38 AM
help with Apple error - null - expecting http://www.w3.org/1999/xhtml" mczajka ePub 3 08-15-2012 08:10 AM


All times are GMT -4. The time now is 06:18 PM.


MobileRead.com is a privately owned, operated and funded community.