Unhandled http redirect from server


#1

Installed seafile-pro-server-6.0.13 on Centos 7. After following all the steps for configuring on NGINX server I am able to connect to the Web interface from multiple machines and using different user accounts upload and download content via the web interface. But when I use Seafile Client 6.0.4 it shows connected to the server, but gives the error when I try to sync My Library. I know it has to be configuration, but not sure what file to look into, any direction appreciated.


#2

This is a known limitation. You should use https url in the client.


#3

I double checked and I am using https URL in the client. Any other thoughts?


#4

Some additional Information. I installed the client on Windows and it syncs no problem using the same account. So I am thinking it is something to do with the MAC client.


#5

Having same problem with Mac client 6.1.7
I am using https url in client, and yet getting Unhandled http redirect from server
When I check Seafile.log I can see https prefix being ignored
[04/09/18 13:56:21] http-tx-mgr.c(1044): libcurl failed to POST http://seafile.bla-bla.com/seafhttp/repo/bla-bla/pack-fs/: Send failed since rewinding of the data stream failed.


#6

Are you behind NGinx? If so, what port are you using for https access?


#7

I am running Seafile docker at ports with following at bootstrap/bootstrap.conf

    server.hostname = seafile.bla-bla.com
    server.port_mappings = 8080:80

And using proxy_pass http://seafile.bla-bla.com:8080/ for both http and https.
When I disable

    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    }

system works, when I don’t - it fails.
Initially I was trying docker image with https enabled and two proxy_pass directives for 80->8080 and 443->44343, but system was still trying to use http before switching to https, so I’ve made my setup simpler


#8

If you are using alternate ports for https in wsgi mode, there is a setting you’ll need to adjust inside the web server portion. I don’t know how to do it in anything other than NGinx as it’s the only thing I’m familiar with.

If using an alternate port for https and you don’t have that setting, when you try to use Seafile, it will revert back to http. Here is the setting I changed in NGinx to solve the problem.

Changing this:

    proxy_set_header   Host $host;

to this works:

    proxy_set_header   Host $host:$server_port;

Post your web server config here and I should be able to figure it out.


#9

I am having the same problem, however with Windows clients only. Linux clients can connect just fine (haven’t tried Mac). Both server and clients have the latest versions installed. I verified that the client is set to use the server starting with https. The client connects, and shows the list of libraries and their respective last updated time, and then after a few seconds, underneath the libraries the last updated time changes to “Unhandled http request from server. Please check server configuration”.

Checking the seafile.log file I see a bunch of items where it is trying to send POST requests to http instead of https, and other times where it is trying to use https correctly.

Server is proxied through Apache. Here is my conf file:

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName seafile
    ServerAlias servername.com

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

    ProxyPass / http://localhost:8000/
    ProxyPassReverse / http://localhost:8000/
    ProxyPreserveHost On

    Alias /media  /opt/seafile/seafile-server-latest/seahub/media

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on

    SSLCertificateFile /etc/letsencrypt/live/servername.com/fullchain.pem
    SSLCertificateChainFile /etc/letsencrypt/live/servername.com/chain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/servername.com/privkey.pem
</VirtualHost>
<VirtualHost *:80> 
    ServerAdmin webmaster@localhost
    ServerName seafile 
    ServerAlias servername.com
    
    # Forward all requests to https
    RewriteEngine On 
    RewriteCond %{HTTPS} !=on
    # For letsencrypt (which requires insecure connections)
    RewriteCond %{REQUEST_URI} !^/.well-known/?(.*)
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    
    DocumentRoot /var/www/html 
    
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I have the SERVICE_URL set to https : //servername in the server’s conf/ccnet.conf file (yay, can’t include links here).

Something else that may be worth noting is that HSTS is implemented for the domain being used, so I’m wondering if this would cause it to fail if for some reason it tried to access HTTP, even if it the request would be forwarded to HTTPS.