1

Topic: iRedMail + nginx proxy problem with SOGo log in

Hi all!
I ran into problems using SOGo (can't login) after upgrading to version 5.7.

I have 2 servers on Ubuntu (18.04 with nginx proxy config) and iRedMail on Ubuntu 20.04 (with SOGo). Get an error message - ERR_CONNECTION_CLOSED.

Unfortunately there are no error messages in the logs and I don't know what to do.

The problem is observed when using SOGo. WebMail on the Roundcube works successfully.

There is a config file on 1 server as a proxy:

```
server {
        listen 80;
        server_name mail.example.com;
        return 301 https://$host$request_uri;
}

server {
      listen 443 ssl http2;
    server_name mail.example.com;

    access_log /var/log/nginx/mail.example.com-access.log;
    error_log /var/log/nginx/mail.example.com-error.log;

    ssl_certificate /etc/letsencrypt/live/mail.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mail.example.com/privkey.pem;
        
            location / {
            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_buffer_size 512k;
            proxy_buffers 8 128k;
            proxy_busy_buffers_size 512k;
            proxy_pass https://10.77.50.85/;

        }
}
```

I set the proxy_buffer*** sizes as recommended by the developers.

There is a SOGo confin file on 2 server (iRedMail):

```
# Settings for SOGo Groupware

# SOGo
location ~ ^/sogo { rewrite ^ https://$host/SOGo; }
location ~ ^/SOGO { rewrite ^ https://$host/SOGo; }

# Redirect /mail to /SOGo
#location ~ ^/mail { rewrite ^ https://$host/SOGo; }

# For Mac OS X and iOS devices.
rewrite ^/.well-known/caldav    /SOGo/dav permanent;
rewrite ^/.well-known/carddav   /SOGo/dav permanent;
rewrite ^/principals            /SOGo/dav permanent;

location ^~ /SOGo {
    include /etc/nginx/templates/hsts.tmpl;

    proxy_pass http://127.0.0.1:20000;
       
    # Обновлено 13.05.22
    proxy_buffer_size          256k;
    proxy_buffers              4 512k;
    proxy_busy_buffers_size    512k;

   
   
    # forward user's IP address
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;

    # always use https
    #$server_port;
    proxy_set_header x-webobjects-server-name $host;
    proxy_set_header x-webobjects-server-url  https://$host;
    proxy_set_header x-webobjects-server-protocol HTTP/1.0;
}

location ^~ /Microsoft-Server-ActiveSync {
    proxy_pass http://127.0.0.1:20000/SOGo/Microsoft-S … ctiveSync;
   
    proxy_buffer_size          256k;
    proxy_buffers              4 512k;
    proxy_busy_buffers_size    512k;
   
    proxy_connect_timeout 3540;
    proxy_send_timeout 3540;
    proxy_read_timeout 3540;
}

location ^~ /SOGo/Microsoft-Server-ActiveSync {
    proxy_pass http://127.0.0.1:20000/SOGo/Microsoft-S … ctiveSync;

    proxy_buffer_size          256k;
    proxy_buffers              4 512k;
    proxy_busy_buffers_size    512k;
   
    proxy_connect_timeout 3540;
    proxy_send_timeout 3540;
    proxy_read_timeout 3540;
}

location /SOGo.woa/WebServerResources/ {
    alias /usr/lib/GNUstep/SOGo/WebServerResources/;
    expires max;
}
location /SOGo/WebServerResources/ {
    alias /usr/lib/GNUstep/SOGo/WebServerResources/;
    expires max;
}
location ^/SOGo/so/ControlPanel/Products/([^/]*)/Resources/(.*)$ {
    alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
    expires max;
}
```

I would appreciate any thoughts on this. Thank you!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Stable release is out.

2

Re: iRedMail + nginx proxy problem with SOGo log in

maxyca wrote:

            proxy_buffer_size 512k;
            proxy_buffers 8 128k;
            proxy_busy_buffers_size 512k;

Try to use same size as Nginx on iRedMail.
Also, turn on debug mode on both Nginx server for troubleshooting.

3

Re: iRedMail + nginx proxy problem with SOGo log in

It helps me:

client_header_buffer_size 1k;
large_client_header_buffers 4 4k;

I added this to the config file on nginx (proxy).

4

Re: iRedMail + nginx proxy problem with SOGo log in

Thanks for sharing. smile