autoconfig/autodiscover 400 Bad Request X-Forwarded-Host

mattin

Member
Feb 10, 2013
11
0
1
Bratislava, Slovakia
cPanel Access Level
Root Administrator
Twitter
Hello,

I tried to enable autodiscover/autoconfig feature for outlook/mozilla and other clients. But after enabling this feature in tweaks options, when i test to load f.e. http://autodiscover.mydomain.com/autodiscover/autodiscover.xml I get only HTTP400 with this error:

Code:
Bad Request

Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.
X-Forwarded-Host
/n
It's the same for http://autodiscover.domain.com or http://autoconfig.domain.com

I'm using the newest cPanel 11.36.0.6

Proxies, redirects and everything works. When I open directly http://ip/cgi-sys/autoconfig.cgi it serves XML with right configuration for mail client.

http://ip/cgi-sys/autodiscover.cgi will redirect to https://cpanelemaildiscovery.cpanel.net/autodiscover/autodiscover.xml but I think this is just because it's called directly.

So the problem is somewhere between apache redirects/proxy.

Code:
   RewriteCond %{HTTP_HOST} ^autodiscover\.
    RewriteRule ^[^?]*(\?.*)? http://127.0.0.1/cgi-sys/autodiscover.cgi [P]
    RewriteCond %{HTTP_HOST} ^autoconfig\.
    RewriteRule ^[^?]*(\?.*)? http://127.0.0.1/cgi-sys/autoconfig.cgi [P]
Thanks for any suggestions.
 

mattin

Member
Feb 10, 2013
11
0
1
Bratislava, Slovakia
cPanel Access Level
Root Administrator
Twitter
Only SOA EXPIRE Your SOA EXPIRE number is: 3601. That is NOT OK.

I managed to get functional autoconfig via hook in nginx configuration.

Code:
###### To redirect autoconfig.yourdomain.com ###########################
server {
access_log off;
error_log  logs/vhost-error_log warn;
listen    80;
server_name  autoconfig.* www.autoconfig.*;
location / {
        client_max_body_size    10m;
        client_body_buffer_size 128k;
        proxy_send_timeout   90;
        proxy_read_timeout   90;
        proxy_buffer_size    4k;
        proxy_buffers     16 32k;
        proxy_busy_buffers_size 64k;
        proxy_temp_file_write_size 64k;
        proxy_connect_timeout 30s;
        proxy_redirect  http://www.autoconfig.*:8888   http://www.autoconfig.*;
        proxy_redirect  http://autoconfig.*:8888   http://autoconfig.*;
        proxy_pass   http://ip/cgi-sys/autoconfig.cgi/;
        }

}
now autoconfig works because I override apache proxy redirect and use direct url.

autodiscover still redirect to cpanel... This is bug I think. I found this http://forums.cpanel.net/f5/autodiscover-dns-records-299412.html. There's path form cpanel staff, but it's from october 2012. Should I try it? Or it's already implemented in my version? I checked also domain SRV record and its pointing to cpanelemaildiscovery.cpanel.net.