Error 400 Bad Request, on non-standard SSL port

884 views
Skip to first unread message

Frederik Beer

unread,
Dec 5, 2013, 10:49:39 AM12/5/13
to sea...@googlegroups.com
Hi there,

I tried to setup Seafile via NGINX and SSL on a non-standard SSL port. However I am running into some problems.

Symptom: The login-page is working perfectly over SSL, however after I hit the "Submit" button I get a 400 Bad Request page, since it tries to load the next page over an ordinary http request, although on the SSL port which is of course failing.
Everything should be running on port 8884. I don't want to use any other port (so no port 80, no port 433, no nothing).

Problem illustrated:
https://XXX.XXX.XXX.XXX:8884 => I see the login page => enter credentials => hit submit => http://XXX.XXX.XXX.XXX:8884 (notice the missing 's' at http) => "400 Bad Request The plain HTTP request was sent to HTTPS port"


Any ideas whats causing this?

Here are my config files:

NGINX:

server {

        listen   8884; ## listen for ipv4

        server_name  XXX.XXX.XXX.XXX;

        ssl on;
        ssl_certificate /etc/ssl.crt/seafile.crt;
        ssl_certificate_key /etc/ssl.key/seafile.pem;

        access_log  /var/log/nginx/localhost.access.log;

        location / {
                fastcgi_pass    127.0.0.1:8000;
                fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
                fastcgi_param   PATH_INFO           $fastcgi_script_name;

                fastcgi_param   SERVER_PROTOCOL     $server_protocol;
                fastcgi_param   QUERY_STRING        $query_string;
                fastcgi_param   REQUEST_METHOD      $request_method;
                fastcgi_param   CONTENT_TYPE        $content_type;
                fastcgi_param   CONTENT_LENGTH      $content_length;
                fastcgi_param   SERVER_ADDR         $server_addr;
                fastcgi_param   SERVER_PORT         $server_port;
                fastcgi_param   SERVER_NAME         $server_name;

                access_log      /var/log/nginx/seahub.access.log;
                error_log       /var/log/nginx/seahub.error.log;
        }

        location /seafhttp {
                rewrite ^/seafhttp(.*)$ $1 break;
                proxy_pass http://127.0.0.1:8082;
                client_max_body_size 0;
        }

        location /media {
                root /home/seafile/secustore/seafile-server-2.0.4/seahub;
        }

        fastcgi_param   HTTPS   on;
        fastcgi_param HTTP_SCHEME https;
}


ccnet.conf:
[General]

seahub_settings.py:



Lingtao Pan

unread,
Dec 5, 2013, 9:21:12 PM12/5/13
to sea...@googlegroups.com
Have you tried put  

     fastcgi_param   HTTPS   on;
     fastcgi_param HTTP_SCHEME https;

inside  location / {} ?

Frederik Beer

unread,
Dec 6, 2013, 11:21:16 AM12/6/13
to sea...@googlegroups.com
Thanks! That was the solution. Working perfectly now! ;)

Regards,
Frederik
Reply all
Reply to author
Forward
0 new messages