mikespub-org/seblucas-cops

Reverse proxy not working

cowboy3d opened this issue · 6 comments

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

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

  1. 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.

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.

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?

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...

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!

Glad to hear it, thanks :-)