rvolz / BicBucStriim

BicBucStriim streams books, digital books. It fills a gap in the functionality of current NAS devices that provide access to music, videos and photos -- but not books. BicBucStriim fills this gap and provides web-based access to your e-book collection.
Other
412 stars 73 forks source link

BicBucStriim behind Gateway #209

Closed mamema closed 8 years ago

mamema commented 8 years ago

Hi,

i've using the latest release and have the following setup:

Web access of BicBucStriim is working internally and externally OPDS server only internally

a cross check install with COPS works internally web and OPDS and externally Web/OPDS

What could this be within BicBucStriim which make OPDS work externally?

Regards

rvolz commented 8 years ago

There is no real difference between the HTML and the OPDS output. The only differences are

What happens when you open the main OPDS page (http..../bbs/opds/) in a web browser? You should be able to see some XML or a RSS feed view, depending on the browser used.

mamema commented 8 years ago

opds page is working. The point is, on OSX&Win FAT Clients web prowser, i get the XML code in the browser, in Apple iOS i get "download this" or "create podcast" in the browser, which is okay, cause the server is responding. Not a 404 answer. But as soon as i try the opds link within marvin (ebook reader iOS), i only get the 5 or 6 main topics (author etc.) and as soon as i want to dive into the menu, i get a "cannot load the catalog" error. Doesn't matter if i use a password (configured in BicBucStriim) or not.

The same works with cops, also with or without password (secured with .htaccess

rvolz commented 8 years ago

Could your problem then be the same as in #120?

mamema commented 8 years ago

No even though in #120 is Marvin mentioned, i haven't installed in root. I have followed the instructions word by word and use the bbs folder in my web folder.

rvolz commented 8 years ago

Ok, then could you please check the URLs in the OPDS root document? According to you some of them are wrong. The start of the OPDS root catalog -- that still works in your case -- looks like this:

<ns0:feed xmlns:ns0="http://www.w3.org/2005/Atom" xml:lang="en">
    <ns0:title>BicBucStriim Root Catalog</ns0:title>
    <ns0:subtitle>The root catalog to the contents of your Calibre library</ns0:subtitle>
    <ns0:author>
        <ns0:name>BicBucStriim 1.3.7a</ns0:name>
        <ns0:uri>http://rvolz.github.com/BicBucStriim</ns0:uri>
    </ns0:author>
    <ns0:id>urn:bbs:calibre:/opds/</ns0:id>
    <ns0:updated>2016-04-29T07:54:27+00:00</ns0:updated>
    <ns0:link href="http://localhost:8080/bbs/opds/" rel="self" type="application/atom+xml;profile=opds-catalog;kind=navigation" />
    <ns0:link href="http://localhost:8080/bbs/opds/" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation" />
    <ns0:entry>
        <ns0:title>By Newest</ns0:title>
        <ns0:id>http://localhost:8080/bbs/opds/newest/</ns0:id>
        <ns0:updated>2016-04-29T07:54:27+00:00</ns0:updated>
        <ns0:content type="text">The 30 most recent titles</ns0:content>
        <ns0:link href="http://localhost:8080/bbs/opds/newest/" rel="http://opds-spec.org/sort/new" type="application/atom+xml;profile=opds-catalog;kind=acquisition" />
    </ns0:entry>

You have to look at the ns0:link href= elements. According to your analysis these are the links where Marvin fails. These URLs should be structurally identical to the HTML URLs that work, have the same host, port etc.

mamema commented 8 years ago

do you have a hint for me how this could be done? As it is within a iphone application. Are the pages saved within marvin? Then it would be possible to get them on a jailbreaked device. Other than that i need some hints to proceed here

rvolz commented 8 years ago

Just use a browser to get the OPDS root catalog and check the URLs. It's the same document Marvin gets.

mamema commented 8 years ago

i'm unable to compare the root opds catalog cause marin has no browser included. I have to configure opds there and the app taks care of the rest. I have checked that nothing gets saved within Marvin

rvolz commented 8 years ago

You don't need Marvin for that. Just use a normal PC browser. It's just to see if the document, when accessed through your gateway, contains the right URLs.

mamema commented 8 years ago

ah okay :-)

Now i have the output and see the "problem". I have modified the output because of public domain adresses.

<?xml version="1.0" encoding="UTF-8"?>

BicBucStriim Hauptkatalog Der Startkatalog ihrer Calibre-Bibliothek BicBucStriim 1.3.6 http://rvolz.github.com/BicBucStriim urn:bbs:calibre:/opds/ 2016-04-30T19:18:29+02:00 Die neuesten http://publicip/bbs/opds/newest/ 2016-04-30T19:18:29+02:00 Die neuesten Titel the href adreses are http, but my gateway, as public reachable has https ssl secured addresses, so bicbucstriim doesn't recognize the the request is coming in from https and wants to response to http Is this something what you can modify, if not, then i can try to rewrite the html response what my gateway accepts and sends..... Odd thing is, i've mentioned this already, that the same gateway config works with cops
rvolz commented 8 years ago

Ah, now I recognize what the problem is: the HTML generator of BicBucStriim mostly uses relative URLs to avoid having to deal with the HTTP/HTTPS differences. Modern browsers can deal with that.

For the OPDS generator that was not possible, because some OPDS clients couldn't handle relative URLs. Therefore it inserts a full URL, and without a gateway/proxy this wasn't a problem.

To solve this issue I'll add a resolution of the standard X-Forwarded header fields, so that these will be used for URL generation, if present. This would require that your gateway sets:

Would this work for you?

mamema commented 8 years ago

This would surely work cause this gateway is the swiss army knife of all gateways existing. I just do not know what rewrite rules for request / response will be needed out of my mind. 😋. Thanks for helping to plan my next weekend....

rvolz commented 8 years ago

Could you please check if that solutions works for you? You can either use the Forwarded header or the X-Forwarded-Host/X-Forwarded-Proto headers in your proxy/gateway configuration.

mamema commented 8 years ago

it's working with x-forwared-to Many thanks