Score:0

outlook autodiscover on nginx reverse proxy

sk flag

I'm new in nginx reverse proxy my problem is outlook cant connect to echange server with auto discovery and open IMAP with this config :

server {
        listen 80;
        server_name email.mydomain.com;
        return 301 https://email.mydomain.com$request_uri;
}

server {
        listen  443;
        server_name email.mydomain.com;
        set $exchange2019 https://internal.ip;

        # Redirect from "/" to "/owa" by default
        rewrite ^/$ https://email.mydomain.com/owa permanent;

        # Enable SSL
        ssl                     on;
        ssl_certificate         /etc/nginx/ssl/email-mobile/Exg-Mobile.crt;
        ssl_certificate_key     /etc/nginx/ssl/email-mobile/Exg-Mobile.rsa;
        ssl_session_timeout     5m;

        # Set global proxy settings
        proxy_pass_request_headers on;
        proxy_read_timeout      360;

        proxy_pass_header       Date;
        proxy_pass_header       Server;

        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_set_header Authorization $http_authorization;
#        proxy_pass_header Authorization;

        location ~* ^/owa      { proxy_pass $exchange2019; }
        location ~* ^/Microsoft-Server-ActiveSync { proxy_set_header X-Forwarded-Proto https; proxy_pass $exchange2016; }
        location ~* ^/ecp { proxy_pass $exchange2019; }
        location ~* ^/Rpc { proxy_pass $exchange2019; }
        #location ~* ^/mailarchiver { proxy_pass https://mailarchiver.local;}
#        location ~* ^/Autodiscover { proxy_pass $exchange2016/Autodiscover; }
#        location ~* ^/autodiscover { proxy_pass $exchange2016/autodiscover; }

        error_log /var/log/nginx/owa-ssl-error.log;
        access_log /var/log/nginx/owa-ssl-access.log;
}
server {

        listen  443;
        server_name autodiscover.mydomain.com;
        set $exchange2019 https://internal.ip;
        # Enable SSL
        ssl                     on;
        ssl_certificate         /etc/nginx/ssl/email-mobile/Exg-Mobile.crt;
        ssl_certificate_key     /etc/nginx/ssl/email-mobile/Exg-Mobile.rsa;
        ssl_session_timeout     5m;

        # Set global proxy settings
        proxy_pass_request_headers on;
        proxy_read_timeout      360;

        proxy_pass_header       Date;
        proxy_pass_header       Server;

        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_set_header Authorization $http_authorization;
        proxy_pass_header Authorization;

        location ~* ^/Autodiscover { proxy_pass $exchange2019/Autodiscover; }
        location ~* ^/autodiscover { proxy_pass $exchange2019/autodiscover; }

        error_log /var/log/nginx/owa-ssl-error.log;
        access_log /var/log/nginx/owa-ssl-access.log;
}

I want to connect to my exchange server from outlook from my internal network and out side with autodiscover but when i add my email address to my outlook IMAP is coming but i want another page in the picture Error

cn flag
The image doesn't really say/show what the problem is. Please [edit](https://serverfault.com/posts/1084234/edit) the question to add more details about what is not actually working.
noshad sadehvand avatar
sk flag
@hardillb Thanks for the help, I changed the picture
cn flag
Adding a `!` before the square bracket to inline the image. Also add text to describe the problem as not everybody can view images.
noshad sadehvand avatar
sk flag
i cant do this because of reputation @hardillb
cn flag
I've done it, it will need to be approved. But you still need to add text to describe the error
noshad sadehvand avatar
sk flag
@hardillb thanks alot
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.