Autodiscover seems to be broken



  • Hi @all,

    since this is my first post, I hope that I explain my problem detailed enough to get help here.

    Scenario:
    I have a kopano multi-server setup (backend, web and mta) which works fine itself using the webapp. Using the stack via ActiveSync works fine too, if I type in the configuration manually. But to make life a lot easier and more comfortable, I want to use z-push-autodiscover.

    My webserver runs with nginx just like my reverse proxy. So I installed z-push-autodiscover and the z-push-nginx modules. Based on the information I found on the web, I learned that I don’t need to configure autodiscover itself.
    So I tried to connect with different clients (iPhone Mail App and Office 365 Outlook) with no success.

    I tried to access the autodiscover address in my web browser to see what the web server responds or if I have an error in my nginx configuration. Instead of the login prompt, I get the following message:

    autodiscover_error.PNG

    In /var/log/nginx/z-push-autodiscover-access.log I get the follwing entry when trying to access via Office 365 (Outlook):

    "POST /autodiscover/autodiscover.xml HTTP/1.0" 405 166 "-" "Microsoft Office/16.0 (Windows NT 10.0; Microsoft Outlook 16.0.12527; Pro)"
    

    Because I’m a newie to z-push I hope you can help me out here.

    Thanks in advance

    Max

    ----- System information in short -----
    OS: Debian 10.3
    Web server: nginx 1.14.2
    Reverse proxy: nginx 1.14.2
    Installed Z-Push Packages: z-push-autodiscover, z-push-backend-kopano, z-push-common, z-push-config-nginx, z-push-ipc-sharedmemory, z-push-kopano
    Z-Push Version (and all packages): 2.5.2+0-0


  • Kopano

    Hi Max,

    it looks like nginx treats the request as getting an xml file, so you have to check your nginx configuration, enabled mods etc. Do you have other web applications running on that server which could interfere?

    How did you configure PHP to run with nginx? Is it PHP-FPM?

    Did you set ZPUSH_HOST value in autodiscover config?

    Manfred



  • Hi Manfred,

    thanks for your reply. On the same host runs the kopano webapp without any problems. My PHP handler is php-fpm which also works fine with webapp.

    I’ve set the ZPUSH_HOST value in /usr/share/z-push/autodiscover/config.php to the address called by client (mail.example.com) but still get the same error

    Max


  • Kopano

    Hi Max,

    it looks like nginx treats the request as getting an xml file, so you have to check your nginx configuration, enabled mods etc. Did you do that?

    Try to disable sites except autodiscover in order to check if the issue is configuration somewhere else.

    Manfred



  • Hi Manfred,

    thanks again for your help. And I’m sorry for the late reply.

    I checked my nginx config files again. I made a huge mistake when combining the webapp and z-push configuration because my webserver listens only to one domain.

    So the php-fpm configuration was wrong inside the combined configuration file. After fixing this AutoDiscovery and ActiveSync works both fine.

    For those few who need exactly this or a similar configuration, here are the modifications I made (even if those are not ideal):

    Add the following lines to the end your webapp configuration:

    location /Microsoft-Server-ActiveSync {
                    # If you're using PHP-FPM uncomment the following lines.
                    include         fastcgi_params;
                    fastcgi_index   index.php;
                    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param   REQUEST_URI $1;
                    fastcgi_param   PHP_FLAG "magic_quotes_gpc=off \n register_globals=off \n magic_quotes_runtime=off \n short_open_tag=on";
                    fastcgi_param   PHP_VALUE "post_max_size=20M \n upload_max_filesize=20M \n max_execution_time=3660";
                    fastcgi_param   HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerabilities
                    fastcgi_read_timeout 3660; # Z-Push Ping might run 3600s, but to be safe
    
                    alias       /usr/share/z-push/index.php;
    
                    access_log  /var/log/nginx/z-push-access.log;
                    error_log   /var/log/nginx/z-push-error.log;
    
                    # Attachments ca 15MB max (since binary data needs to be base64 encoded in mine, which results in in about 33% overhead)
                    client_max_body_size 20m;
                    client_body_buffer_size 128k;
    
                    # Select one of the fastcgi_pass values or adapt to your configuration
                    include snippets/z-push-php.conf;
            }
    
            location /AutoDiscover/AutoDiscover.xml {
                    # If you're using PHP-FPM uncomment the following lines.
                    include                          fastcgi_params;
                    fastcgi_index   index.php;
                    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param   REQUEST_URI $1;
                    fastcgi_param   PHP_FLAG "magic_quotes_gpc=off \n register_globals=off \n magic_quotes_runtime=off \n short_open_tag=on";
                    fastcgi_param   PHP_VALUE "post_max_size=20M \n upload_max_filesize=20M \n max_execution_time=3660";
    
                    include snippets/z-push-autodiscover.conf;
                    include snippets/z-push-php.conf;
            }
    
            location /Autodiscover/Autodiscover.xml {
                    # If you're using PHP-FPM uncomment the following lines.
                    include                          fastcgi_params;
                    fastcgi_index   index.php;
                    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param   REQUEST_URI $1;
                    fastcgi_param   PHP_FLAG "magic_quotes_gpc=off \n register_globals=off \n magic_quotes_runtime=off \n short_open_tag=on";
                    fastcgi_param   PHP_VALUE "post_max_size=20M \n upload_max_filesize=20M \n max_execution_time=3660";
                    fastcgi_param   HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerabilities
                    fastcgi_read_timeout 3660; # Z-Push Ping might run 3600s, but to be safe
    
                    include snippets/z-push-autodiscover.conf;
                    include snippets/z-push-php.conf;
            }
    
            location /autodiscover/autodiscover.xml {
                    # If you're using PHP-FPM uncomment the following lines.
                    include                          fastcgi_params;
                    fastcgi_index   index.php;
                    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param   REQUEST_URI $1;
                    fastcgi_param   PHP_FLAG "magic_quotes_gpc=off \n register_globals=off \n magic_quotes_runtime=off \n short_open_tag=on";
                    fastcgi_param   PHP_VALUE "post_max_size=20M \n upload_max_filesize=20M \n max_execution_time=3660";
                    fastcgi_param   HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerabilities
                    fastcgi_read_timeout 3660; # Z-Push Ping might run 3600s, but to be safe
    
                    include snippets/z-push-autodiscover.conf;
                    include snippets/z-push-php.conf;
            }
    

    And don’t forget to configure your php-fpm settings in /etc/nginx/snippets/z-push-php.conf …I heared that some modules don’t work if you forget this…

    And thanks again to @Manfred for the help


Log in to reply