seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.43k stars 229 forks source link

Cops + htaccess problems #415

Closed Zoldex closed 5 years ago

Zoldex commented 5 years ago

Configured htaccess with username and password on my webserver and it seems to properly work with HTML index.php. But with FBreader and Moon reader after succesfully logging in it seems good but it doesn't show covers AND download does not work. I've read through the FAQ, especially "COPS seems to be working correctly (I can see covers and book information) but I can't download books" (though I DON'T see covers and can't download). So I make sure to leave cops_use_url_rewriting = 0 and didn't touch NGINX settings, but had no luck.

I tried removing .htaccess protection and everything works fine!

What's wrong?

erdoking commented 5 years ago

I use Moon reader with Apache authentication (like htaccess) with covers ... You need a little special config for it!

That is a little security problem but for me it works like a charm...

The apache-part - for reverse proxy ...: ` AuthType Basic AuthName "Authentication Required" AuthUserFile /etc/apache2/cops.passwd

  RedirectMatch ^/cops/(.*) /$1

  <RequireAny>
      <RequireAll>
          Require expr %{REQUEST_URI} =~ m#^/fetch.php.*#
      </RequireAll>
      <RequireAll>
          Require expr %{REQUEST_URI} =~ m#^/cops/fetch.php.*#
      </RequireAll>

      require valid-user
  </RequireAny>

  ## cops
  ProxyPass  http://172.16.x.x/cops/
  ProxyPassReverse  http://172.16.x.x/cops/

`

Cops-config: config_local.php: $config ['cops_fetch_protect'] = "0";