Apache2 proxy poduce "server error"

Hello,

I’m trying to enable apache2 http proxy to use SSL. With “no apache2 proxy” and use http://SERVER_IP:8000: desktop client work fine. But after enable apache2 proxy and use https://my.server: client correctly connect, but say “Server error” when trying to sync a folder.

Using seafile-server-6.0.9 on debian 7 and desktop client 6.1.0 on Ubuntu 16.04. I followed these instructions: https://manual.seafile.com/deploy/deploy_with_apache.html

The client log when i use http://SERVER_IP:8000 and working fine (seafile.log):

[08/17/17 09:41:22] clone-mgr.c(840): Transition clone state for 755203e0 from [init] to [check server].
[08/17/17 09:41:23] http-tx-mgr.c(1236): Bad response code for GET http://SERVER_IP:8000/seafhttp/protocol-version: 404.
[08/17/17 09:41:23] clone-mgr.c(840): Transition clone state for 755203e0 from [check server] to [fetch].
[08/17/17 09:41:23] http-tx-mgr.c(4288): Download with HTTP sync protocol version 1.
[08/17/17 09:41:23] http-tx-mgr.c(1132): Transfer repo '755203e0': ('normal', 'init') --> ('normal', 'check')
[08/17/17 09:41:23] http-tx-mgr.c(1132): Transfer repo '755203e0': ('normal', 'check') --> ('normal', 'commit')
[08/17/17 09:41:23] http-tx-mgr.c(1132): Transfer repo '755203e0': ('normal', 'commit') --> ('normal', 'fs')
[08/17/17 09:41:23] http-tx-mgr.c(1132): Transfer repo '755203e0': ('normal', 'fs') --> ('normal', 'data')
[08/17/17 09:41:23] http-tx-mgr.c(1132): Transfer repo '755203e0': ('normal', 'data') --> ('finished', 'finished')
[08/17/17 09:41:24] clone-mgr.c(840): Transition clone state for 755203e0 from [fetch] to [done].
[08/17/17 09:41:24] http-tx-mgr.c(1236): Bad response code for GET http://SERVER_IP:8000/seafhttp/protocol-version: 404.
[08/17/17 09:41:25] sync-mgr.c(702): Repo 'My Library' sync state transition from 'synchronized' to 'committing'.
[08/17/17 09:41:25] repo-mgr.c(3739): All events are processed for repo 755203e0-e872-4953-afd6-56baa2eb0607.
[08/17/17 09:41:25] sync-mgr.c(702): Repo 'My Library' sync state transition from 'committing' to 'initializing'.
[08/17/17 09:41:25] sync-mgr.c(1516): Removing blocks for repo My Library(755203e0).

The client log when i use `https://my.server`` and fail at folder sync (seafile.log):

[08/17/17 09:44:09] clone-mgr.c(840): Transition clone state for 755203e0 from [error] to [check server].
[08/17/17 09:44:09] http-tx-mgr.c(1236): Bad response code for GET https://my.server/seafhttp/protocol-version: 404.
[08/17/17 09:44:09] clone-mgr.c(857): Transition clone state for 755203e0 from [check server] to [error]: check server.
[08/17/17 09:44:14] clone-mgr.c(840): Transition clone state for 755203e0 from [error] to [check server].
[08/17/17 09:44:14] http-tx-mgr.c(1236): Bad response code for GET https://my.server/seafhttp/protocol-version: 404.
[08/17/17 09:44:14] clone-mgr.c(857): Transition clone state for 755203e0 from [check server] to [error]: check server.
[08/17/17 09:44:19] clone-mgr.c(840): Transition clone state for 755203e0 from [error] to [check server].
[08/17/17 09:44:19] http-tx-mgr.c(1236): Bad response code for GET https://my.server/seafhttp/protocol-version: 404.
[08/17/17 09:44:19] clone-mgr.c(857): Transition clone state for 755203e0 from [check server] to [error]: check server.
[08/17/17 09:44:24] clone-mgr.c(840): Transition clone state for 755203e0 from [error] to [check server].
[08/17/17 09:44:24] http-tx-mgr.c(1236): Bad response code for GET https://my.server/seafhttp/protocol-version: 404.
[08/17/17 09:44:24] clone-mgr.c(857): Transition clone state for 755203e0 from [check server] to [error]: check server.
[08/17/17 09:44:29] clone-mgr.c(840): Transition clone state for 755203e0 from [error] to [check server].
[08/17/17 09:44:29] http-tx-mgr.c(1236): Bad response code for GET https://my.server/seafhttp/protocol-version: 404.
[08/17/17 09:44:29] clone-mgr.c(857): Transition clone state for 755203e0 from [check server] to [error]: check server.
[08/17/17 09:44:34] clone-mgr.c(840): Transition clone state for 755203e0 from [error] to [check server].
[08/17/17 09:44:34] http-tx-mgr.c(1236): Bad response code for GET https://my.server/seafhttp/protocol-version: 404.
[08/17/17 09:44:34] clone-mgr.c(857): Transition clone state for 755203e0 from [check server] to [error]: check server.

There is some configurations. Apache2 virtualhost:

<VirtualHost *:443>
  ServerName my.server

  #ProxyRequests     Off
  #ProxyPreserveHost On

  #ProxyPass / http://127.0.0.1:8000/
  #RequestHeader set X_FORWARDED_PROTO 'https'

  SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  ProxyPass / http://127.0.0.1:8000/  

  ProxyPass /seafhttp http://127.0.0.1:8082
  ProxyPassReverse /seafhttp http://127.0.0.1:8082
  RewriteRule ^/seafhttp - [QSA,L]

  # Custom log file locations
  ErrorLog  /var/log/apache2/seafile_error.log
  CustomLog /var/log/apache2/seafile_access.log combined
  
  Alias /media /opt/haiwen/seafile-server-6.0.9/seahub/media
  
  RewriteEngine On

  <Location /media>
    Require all granted
  </Location>

  # ssl
  SSLCertificateFile /etc/letsencrypt/live/my.server/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/my.server/privkey.pem
  Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

server ccnet.conf:

[General]
USER_NAME = xxxxxxxx
ID = xxxxxxxxxxxxxxxxxxxxxxxxxxxx
NAME = xxxxxxxxx
SERVICE_URL = https://my.server

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = XXXXXXXXX
DB = ccnet-db
CONNECTION_CHARSET = utf8

server seahub_settings.py:

# -*- coding: utf-8 -*-
SECRET_KEY = "xxxxxxxxxxxxxxxxxxxx"

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'seafile',
        'PASSWORD': 'xxxxxxxxxxxxxx',
        'HOST': '127.0.0.1',
        'PORT': '3306'
    }
}

FILE_SERVER_ROOT = 'https://my.server/seafhttp'

Server seafile.log:

[08/17/2017 09:37:27 AM] ../common/mq-mgr.c(54): [mq client] mq cilent is started

Server ccnet.log:

[08/17/17 09:37:24] ../common/session.c(369): Exit at Thu Aug 17 09:37:24 2017

[08/17/17 09:37:26] ../common/session.c(132): using config file /opt/haiwen/conf/ccnet.conf
[08/17/17 09:37:26] ../common/session.c(455): socket file exists, delete it anyway
[08/17/17 09:37:26] ../common/session.c(484): Listen on /opt/haiwen/ccnet/ccnet.sock for local clients
[08/17/17 09:37:26] ../common/session.c(290): Update pubinfo file
[08/17/17 09:37:27] ../common/session.c(398): Accepted a local client
[08/17/17 09:37:27] ../common/session.c(398): Accepted a local client
[08/17/17 09:37:27] ../common/session.c(398): Accepted a local client
[08/17/17 09:37:27] ../common/session.c(398): Accepted a local client
[08/17/17 09:37:38] ../common/session.c(398): Accepted a local client
[08/17/17 09:37:38] ../common/peer.c(943): Local peer down
[08/17/17 09:37:44] ../common/session.c(398): Accepted a local client
[08/17/17 09:37:45] ../common/session.c(398): Accepted a local client
[08/17/17 09:37:48] ../common/session.c(398): Accepted a local client

Server controller.log:

[08/17/17 09:37:24] seafile-controller.c(566): shutting down ccnet-server ...
[08/17/17 09:37:26] seafile-controller.c(154): starting ccnet-server ...
[08/17/17 09:37:26] seafile-controller.c(73): spawn_process: ccnet-server -F /opt/haiwen/conf -c /opt/haiwen/ccnet -f /opt/haiwen/logs/ccnet.log -d -P /opt/haiwen/pids/ccnet.pid
[08/17/17 09:37:26] seafile-controller.c(88): spawned ccnet-server, pid 3207
[08/17/17 09:37:27] seafile-controller.c(555): ccnet daemon connected.
[08/17/17 09:37:27] seafile-controller.c(186): starting seaf-server ...
[08/17/17 09:37:27] seafile-controller.c(73): spawn_process: seaf-server -F /opt/haiwen/conf -c /opt/haiwen/ccnet -d /home/seafile -l /opt/haiwen/logs/seafile.log -P /opt/haiwen/pids/seaf-server.pid
[08/17/17 09:37:27] seafile-controller.c(88): spawned seaf-server, pid 3215
[08/17/17 09:37:27] seafile-controller.c(528): seafdav not enabled.

Server seahub_django_request.log:

2017-08-17 07:58:59,853 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2017-08-17 07:59:04,854 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2017-08-17 07:59:09,855 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2017-08-17 07:59:14,855 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2017-08-17 07:59:19,855 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2017-08-17 07:59:24,857 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2017-08-17 07:59:29,857 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version

Any idea about reason of error ?

In the admin panel on the web portal, make sure the “file_server_root” and “service_url” match your https://my.server and are not using the server IP.

This file_server_root config is set to https://my.server/seafhttp and service_url is https://my.server.