Skip to content

Instantly share code, notes, and snippets.

@tonysm
Last active July 2, 2018 14:11
Show Gist options
  • Save tonysm/8d0da29d5fcd6658e6708c55d42f0d75 to your computer and use it in GitHub Desktop.
Save tonysm/8d0da29d5fcd6658e6708c55d42f0d75 to your computer and use it in GitHub Desktop.
Nginx Proxy for Mailcatcher
# Place this outside the server {}
# Mailcatcher Websockets upgrade
# As suggested in http://nginx.org/en/docs/http/websocket.html
map $http_upgrade $connection_upgrade {
default upgrade;
"" close;
}
# Place this inside the server {}, remove any other location block
# Mailcatcher proxy
location / {
proxy_pass http://127.0.0.1:1080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
auth_basic "Development server. Restricted access.";
auth_basic_user_file /etc/nginx/.htpasswd; # Create a htpasswd file and credentials
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment