mikespub-org / 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
55 stars 7 forks source link

Reverse proxy not working #80

Closed cowboy3d closed 2 months ago

cowboy3d commented 2 months ago

Running this version behind an apache server configured as reverse proxy is not working for me.

I run this version of cops inside a docker container with its own IP adress. Accessing it using IP adress or configured host name (http://picops) works perfectly. But accessing it from my main web server (apache) using http://apache/cops/ I only see a blank page...

Apache config:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html

        ProxyPass /cops/ http://picops/
        ProxyPassReverse /cops/ http://picops/

Any ideas what I am doing wrong here?

Kind regards

Stephan

mikespub commented 2 months ago

Let's start with the basics:

  1. did you change config_local.php to define the full URL of your proxy with something like

    $config['cops_full_url'] = 'http://apache/cops/';

    See config_default.php for details

  2. what do you see when you access http://apache/cops/checkconfig.php

With your setup, after changing 1. above the base URL detected by the script would still be / while the full URL should be whatever you configured.

cowboy3d commented 2 months ago

Thanks a lot for your effort to support me!

Checkconfig.php reports the following called directly or using the proxy.

Check if the base URL looks OK
Base URL detected by the script: /
Full URL specified in $config['cops_full_url']:

SCRIPT_NAME: /checkconfig.php
HTTP_HOST: picops
SERVER_NAME: picops
SERVER_ADDR: 192.168.0.204
SERVER_PORT: 80
REQUEST_SCHEME: http
REQUEST_URI: /checkconfig.php

The moment I set $config['cops_full_url'] I just get a blank page no matter if I try to access it directly or using the proxy. The source of the empty page looks like

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

My setup is using the container from linuxserver.

mikespub commented 2 months ago

Hi @cowboy3d sorry to hear that.

That sounds like you have a PHP syntax error in your config_local.php file now. Can you double-check the changes you made and try again?

mikespub commented 2 months ago

Note: you can verify the syntax directly from your server console. Assuming your container is called "cops" by default:

$ docker exec cops php -l /app/www/public/config_local.php
Errors parsing /app/www/public/config_local.php
PHP Parse error:  syntax error, unexpected end of file in /app/www/public/config_local.php on line 80

And when there's no error:

$ docker exec cops php -l /app/www/public/config_local.php
No syntax errors detected in /app/www/public/config_local.php

Be sure to stop & restart the container after each change, or it won't have any immediate effect.

Or if you have PHP installed on your server too, you can check the config_local.php file directly of course...

cowboy3d commented 2 months ago

Thank you very much! I did really mess up my config_local.php - now having it done correctly, I works as expect.

Thanks for your patience and time!

mikespub commented 2 months ago

Glad to hear it, thanks :-)