Seafile 13 docker using apache as proxy, cant upload files

i have apache set up as my proxy and the web interface is working ok until i try to upload a file then i get a network error.
i have set
SEAFILE_SERVER_HOSTNAME=mydomain.com
SEAFILE_SERVER_PROTOCOL=https
so i must be missing something on the apache proxy config, but cant see what.

i have my proxy on port 8443
my apache site config is:-

<VirtualHost *:8443>
ServerName mydomain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine On

SSLEngine on
SSLCertificateFile    /etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem

ProxyPass /seafmedia http://127.0.0.1/seafmedia
ProxyPassReverse /seafmedia http://127.0.0.1/seafmedia

<Location /seafmedia>
    Require all granted
</Location>

ProxyPass /seafhttp http://127.0.0.1:8080
ProxyPassReverse /seafhttp http://127.0.0.1:8080
RewriteRule ^/seafhttp - [QSA,L]
 ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:80/
    ProxyPassReverse / http://127.0.0.1:80/

    # Proxy for Seafile services
    ProxyPass /sdoc-server/ http://127.0.0.1:8888/
    ProxyPassReverse /sdoc-server/ http://127.0.0.1:8888/

    # Optionally for WebSocket support
    ProxyPass /socket.io http://127.0.0.1:8888/socket.io
    ProxyPassReverse /socket.io http://127.0.0.1:8888/socket.io
</VirtualHost>

seadoc.yml has the ports section:-
ports:

  • “8888:80”

seafile-server.yml has the ports section:-
ports:

  • “80:80”

can anybody see what i am missing? thx.

A possible problem is that you are running on 8443. There have been other threads here with people having trouble getting things working on any port other than 443. I don’t think non-standard ports are supported anymore. I don’t know that this is causing the problem, but it might be.

also

I am not very good with apache, but I tried to compare your config to my nginx reverse proxy config. It looks like your config does these things:

Compared to mine which does:

  • Forward /notification to the notification server
  • Return 404 for anything in /sdoc-server (I don’t run seadoc server)
  • Forward everything else to http://seafileserver:8001
    my seafile-server config has ports “8001:80”

So, it looks like your config has several sections you don’t really need which could be causing or contributing to the problem. These are probably left over from instructions for seafile before docker. Now with docker you have an nginx inside the seafile container doing some of that for you so you don’t need apache doing it anymore.

You probably want to cut down to just the /socket.io and /sdoc-server to forward those things to seadoc, and the “everthing else” / forwarding to seafile.

i removed everything except what you list and the result is the same, network error regardless of using port 8443 or 443

what i have now is

#####################
# Notification server
#
ProxyPass /notification/ping  http://127.0.0.1:8083/ping/
ProxyPassReverse /notification/ping  http://127.0.0.1:8083/ping/

ProxyPass /notification http://127.0.0.1:8083/
ProxyPassReverse /notification http://127.0.0.1:8083
####################

####################
# WebSocket support
#
ProxyPass /socket.io http://127.0.0.1:8888/
ProxyPassReverse /socket.io http://127.0.0.1:8888/socket.io/
####################

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

It looks to me like that should work. I guess the next step would be to find out specifically what is failing. In your browser, get to where you are looking at a library, then hit the F12 key, and go to the network section. Then drag a small file into the window to upload it. That network section should show a list of URLs that were accessed and the result of each item. It will be things like api/v2.1/repos/18404316-945a-4420-9ccf-51bd884a758c/file-uploaded-bytes/?parent_dir=%2F&file_name=syslog

ok, when i do that the network window shows
/api/v2.1/repos/c6ecc733-15fa-44d3-a738-9a766dd2d540/file-uploaded-bytes/?parent_dir=%2F&file_name=71422825.pdf with status 200 ok

then

seafhttp/upload-aj/edc2d67f-ed8d-41d2-b741-18eb2861d297?ret-json=1 404 not found
with a red cross next to it in the list

does that show us anything?

after looking at the actual errors listed by chrome i could see it was a CORS error.
i might be using a sledgehammer to crack a walnut, but i put this in my seahub_settings.py

CSRF_TRUSTED_ORIGINS = [“http://mydomain.com”,
“http://*.mydomain.com",
https://mydomain.com”,
“https://*.mydomain.com”,
https://mydomain.com:443”,
“https://*.mydomain.com:443”,
https://mydomain.com:8443”,
"https://
*.mydomain.com:8443”
]

and put this in may apache 000-default.conf

<location /seafhttp>
    Order Allow,Deny
    Allow from all
    AllowOverride all
    Header always set Access-Control-Allow-Origin "*"
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
    Header always set Access-Control-Expose-Headers "Content-Security-Policy, Location"
    Header always set Access-Control-Max-Age "600"
Type, Authorization"
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} OPTIONS
    RewriteRule ^(.*)$ $1 [R=200,L]
</location>

and it’s working.

Sorry I didn’t get back to you quicker. Glad you got it working though!