Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 09-26-2013, 02:47 AM   #1
SirMossi
Junior Member
SirMossi began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2013
Device: Sony PRS T2
problems accessing calibre-server with proxy configured

Hello,

I try to setup a calibre-server with apache authentication. The main approach works just fine. But I have some problems when accessing the library from Aldiko app on android.

Here my configuration:

I've started the calibre-server with the following command on port 8080:
Code:
calibre-server --with-library=\"$CALIBRE_LIBRARY_PATH\" -p $PORT --pidfile=$PIDFILE --daemonize
Now I can access the library using the URL http://domain.tld:8080
This works also in Aldiko reader.

To make it more secure, I've configured a apache virtual host:
Code:
<VirtualHost *:80>
	ServerAdmin mail@domain.tld
	ServerName calibre.domain.tld
	ServerAlias calibre.*
	ErrorLog /var/log/apache2/calibre-error_log
	CustomLog /var/log/apache2/calibre-access_log common
	ProxyPass / http://localhost:8080/
	ProxyPassReverse / http://localhost:8080/
	SetEnv force-proxy-request-1.0 1
	SetEnv proxy-nokeepalive 1
	<Location />
		Deny from all
		AuthType Basic
		AuthName "Calibre"
		AuthUserFile /etc/apache2/passwd
		Require valid-user 
		Satisfy Any
	</Location>
</VirtualHost>
I've tried this from browser and it just works fine using the url http://calibre.domain.tld. Also Aldiko could access the library. I have to enter my user and my password and all is Ok.

To make it more secure, I've closed the port 8080 in firewall to deny access this port from outside.

Code:
iptables -A INPUT -d domain.tld -p tcp --destination-port 8080 -j REJECT
Tried from browser and it works. Now it's not anymore possible to access the library with the direct path to the port, but with my virtual host domain I could access it.

But from Aldiko it does not work. Aldiko does not load any images, js files and so on. Only the main index.html is loaded without any formattings. I've checked my apache log files and see, that all loaded files returned a 404 error.

What did I configured wrong? Or is it a problem from Aldiko? I hope that someone here already set up such a server and could help me to solve the problem.

Thank you at all
SirMossi is offline   Reply With Quote
Old 09-26-2013, 04:17 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I don't use aldiko, but the configuration below works with FBReader and Calibre Companion.

It is slightly edited to remove personal information. It uses a port (9191) rather than a named virtual host. The port calibre is listening on (9192) is blocked. It uses digest authentication to avoid passing clear-text passwords around, which you should also use unless you intend to use SSL or aldiko doesn't support it.

Code:
<VirtualHost *:9191>
        <Location "/">
                AuthType Digest
                AuthName "******************"
                AuthDigestDomain /
                AuthDigestProvider file
                AuthUserFile *****/library_digest_pw.txt
                Require valid-user
        </Location>
        RewriteEngine on
        RewriteRule ^(.*) http://127.0.0.1:9192/$1 [proxy]
        SetEnv force-proxy-request-1.0 1
        SetEnv proxy-nokeepalive 1
</VirtualHost>
BTW: why are you using the root page with aldiko? Shouldn't you be using http://calibre.../opds ? There is no javascript in the opds version, and I would be surprised if aldiko knows how to deal with it.
chaley is offline   Reply With Quote
Advert
Old 09-26-2013, 04:24 AM   #3
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
@chaley: If the applications ends a Want-OPDS-Catalog header or pretends to be Stanza, the root page resolves to /opds. I'd guess Aldiko is sending that header.
kovidgoyal is offline   Reply With Quote
Old 09-26-2013, 04:33 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
@chaley: If the applications ends a Want-OPDS-Catalog header or pretends to be Stanza, the root page resolves to /opds. I'd guess Aldiko is sending that header.
But in that case aldiko wouldn't be asking the server for javascript files, which the OP says it is doing.
chaley is offline   Reply With Quote
Old 09-26-2013, 07:16 AM   #5
SirMossi
Junior Member
SirMossi began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2013
Device: Sony PRS T2
Thank you for reply.
I've tried now the rewrite rule, but I've still the same error.
I've checked again my log files from apache and find out, that the problem is, that the authorization was lost.

Code:
87.138.86.47 - mossi [26/Sep/2013:11:10:54 +0000] "GET / HTTP/1.1" 200 2881
87.138.86.47 - - [26/Sep/2013:11:10:54 +0000] "GET /mobile/style.css HTTP/1.1" 401 636
87.138.86.47 - - [26/Sep/2013:11:10:54 +0000] "GET /static/calibre.png HTTP/1.1" 401 636
87.138.86.47 - - [26/Sep/2013:11:10:54 +0000] "GET /get/thumb/4480 HTTP/1.1" 401 635
87.138.86.47 - - [26/Sep/2013:11:10:54 +0000] "GET /get/thumb/4479 HTTP/1.1" 401 636
87.138.86.47 - - [26/Sep/2013:11:10:54 +0000] "GET /get/thumb/4478 HTTP/1.1" 401 636
As you can see, the first GET uses the username "mossi", but the following requests do not use any username.
I think, this a problem with my apache configuration, but I have no idea why this is happening only with this site.

off: I changed authorization to basic auth because of this problem. I already changed it back to digest mode.

edit: I tested now with my PRS-T2 and I there is a similar problem. The images are shown here, but when downloading an EPUB, Ive got the same error.

Last edited by SirMossi; 09-26-2013 at 07:19 AM.
SirMossi is offline   Reply With Quote
Advert
Old 09-26-2013, 07:37 AM   #6
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I would guess that it is aldiko that is broken. It should respond to the 401 with the credentials, which it is apparently not doing.

As for the sony, there is a well-known bug in older versions of android (and perhaps newer ones) where credentials are not presented when downloading files. The calibre content server tries to work around this by sending back authorization cookies, but it seems that the sony is not returning them when it starts the download.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre 2 behind Windows Proxy Server ictstbenedicts Calibre 1 10-10-2012 12:41 PM
500 Internal Server Error accessing content server Calibre 0.8.8 DaddyO57 Calibre 1 07-20-2012 06:08 PM
further proxy server problems ren41 Library Management 2 10-04-2011 01:31 PM
Problems accessing sdcard from calibre (and linux) carpii Calibre 14 03-11-2010 01:53 PM
Proxy authentication problems (I have no proxy) fogus Calibre 16 03-08-2009 01:27 PM


All times are GMT -4. The time now is 05:41 PM.


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