I use Seafile behind an Apache proxy without a caddy.
Seafile runs flawlessly but the connection from the sdoc-server does not work.
I can create a *.sdoc document but cannot open it, I get the message that there was an error loading the document.
When I try to open a page in the wiki, an “Axios error” appears
When I open port 8888 locally in the browser, I am greeted by the message: “Welcome to sdoc-server. The current version is 1.0.5”.
So the service seems to be running and accessible via an entry in nginx.conf.
location /sdoc-server/ {
proxy_pass http://127.0.0.1:8888/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
client_max_body_size 100m;
}
location /socket.io {
proxy_pass http://127.0.0.1:8888/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
What is my problem since it cannot open an *.sdoc file, even locally?
You said you are using apache as your reverse proxy, but then you give an nginx config. Where is this nginx configuration, in the nginx inside the seafile-server container?
I suspect that what you need to do is translate that nginx config into apache and put it in your reverse proxy’s config.
My Nginx config from seafile:
# -*- mode: nginx -*-
# Auto generated at 03/04/2025 21:51:27
server {
listen 80;
server_name 192.168.1.91 myseafile.server.dyndns.com;
client_max_body_size 10m;
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_read_timeout 310s;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection "";
proxy_http_version 1.1;
client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log seafileformat;
error_log /var/log/nginx/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_request_buffering off;
access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}
location /sdoc-server/ {
proxy_pass http://127.0.0.1:8888/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
client_max_body_size 100m;
}
location /socket.io {
proxy_pass http://127.0.0.1:8888/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
location /notification/ping {
proxy_pass http://127.0.0.1:8083/ping;
access_log /var/log/nginx/notification.access.log seafileformat;
error_log /var/log/nginx/notification.error.log;
}
location /notification {
proxy_pass http://127.0.0.1:8083/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
access_log /var/log/nginx/notification.access.log seafileformat;
error_log /var/log/nginx/notification.error.log;
}
location /seafdav {
rewrite ^/seafdav$ /seafdav/ permanent;
}
location /seafdav/ {
proxy_pass http://127.0.0.1:8080/seafdav/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
client_max_body_size 0;
proxy_request_buffering off;
access_log /var/log/nginx/seafdav.access.log seafileformat;
error_log /var/log/nginx/seafdav.error.log;
}
location /:dir_browser {
# Logo of WebDAV
proxy_pass http://127.0.0.1:8080/:dir_browser;
}
location /media {
root /opt/seafile/seafile-server-latest/seahub;
}
}
My Apache proxy for 192.168.1.91:
<VirtualHost *:443>
ServerAdmin admin@server.com
ServerName myseafile.server.dyndns.com
SetEnvIf Request_URI ^/server-status$ dontlog
CustomLog /var/log/apache2/access.log combined env=!dontlog
ErrorLog /var/log/apache2/error.log
LogLevel warn
Protocols h2 http/1.1
# LetsEncrypt
SSLCertificateKeyFile /etc/letsencrypt/live/myseafile.server.dyndns.com/privkey.pem
SSLCertificateFile /etc/letsencrypt/live/myseafile.server.dyndns.com/fullchain.pem
SSLEngine on
LimitXMLRequestBody 0
LimitRequestBody 0
RewriteEngine On
## seahub
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
ProxyRequests off
ProxyPreserveHost On
ProxyPass / http://192.168.1.91:8000/
ProxyPassReverse / http://192.168.1.91:8000/
## seafile fileserver
ProxyPass /seafhttp http://192.168.1.91:8082
ProxyPassReverse /seafhttp http://192.168.1.91:8082
RewriteRule ^/seafhttp - [QSA,L]
## seafile webdav
ProxyPass /seafdav http://192.168.1.91:8080/seafdav
ProxyPassReverse /seafdav http://192.168.1.91:8080/seafdav
</VirtualHost>
pm1234
March 17, 2025, 7:41pm
4
how is our SEAHUB_SERVICE_URL defined ? is it http or https?
for me it only worked when it was https
Yes, it is https.
I have only the problem to use *. sdoc, all other works fine.
pm1234
March 17, 2025, 8:03pm
6
then your issue must be different, although the symptoms are similar.
on my test installation also everything was working, except sdoc. Due to whatever reason I managed to define SEAHUB_SERVICE_URL without https in seadoc.yml, which then caused my issues.
Here my settings for this
SEAFILE_SERVER_HOSTNAME=myseafile.server.dyndns.com
SEAFILE_SERVER_PROTOCOL=https
ENABLE_SEADOC=true
SEADOC_SERVER_URL=https://myseafile.server.dyndns.com/sdoc-server
I suspect that it is a rewrite problem, but I lack the knowledge in this area
I think I see the problem. Your connections for seadoc go to the seafile container, and then are forwarded to port 8888 inside that container (proxy_pass http://127.0.0.1:8888/; ), but seadoc is in another container. You could try to edit that config to have the container IP for the seadoc container, but that’s likely to change, and this config file will probably be replaced next time the seafile container is updated (or maybe even when restarted).
So I think you need to forward from your reverse proxy straight to seadoc. That’s probably something like this. I am sure there’s an apache equivelent to all those “proxy_buffers” and “proxy_set_header” but I don’t know it. Hopefully it will be at least close enough to work without them
## Seadoc
ProxyPass /sdoc-server http://192.168.1.91:80/sdoc-server
ProxyPassReverse /sdoc-server http://192.168.1.91:80/sdoc-server
ProxyPass /socket.io http://192.168.1.91:80/socket.io
ProxyPassReverse /socket.io http://192.168.1.91:80/socket.io
And in the seadoc.yml make sure you have port 80 being forwarded like this:
ports:
- "80:80"
Thank you,
i will test the settings, but my port is set to
ports:
- "8888:80"
in seadoc.yml.
My seafile-server.yml runs under:
ports:
-"8000:80"
I testet, this is in my browser console:
has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
now