Skip to content

Instantly share code, notes, and snippets.

@0wQ
Last active March 19, 2024 08:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0wQ/3c6b10c5384070d01dff5c6222001b28 to your computer and use it in GitHub Desktop.
Save 0wQ/3c6b10c5384070d01dff5c6222001b28 to your computer and use it in GitHub Desktop.
Outlook Exchange Proxy
# https://docs.nginx.com/nginx/deployment-guides/load-balance-third-party/microsoft-exchange/
server {
listen 80;
listen 443 ssl http2;
server_name example.com;
keepalive_timeout 3h;
proxy_read_timeout 3h;
tcp_nodelay on;
location = / {
return 301 '/owa/';
}
location = /owa/ {
return 302 'https://outlook.live.com/owa/';
}
location = /favicon.ico {
empty_gif;
access_log off;
}
location / {
set $flag 0;
if ( $remote_user = '' ) { set $flag 1; }
if ( $remote_user = '-' ) { set $flag 1; }
if ( $remote_user = 'your_mail@live.com' ) { set $flag 1; }
if ( $flag = 0 ) { return 401; }
proxy_pass https://www.outlook.com;
proxy_buffering off;
proxy_http_version 1.1;
proxy_request_buffering off;
proxy_set_header Connection 'Keep-Alive';
}
include ssl.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment