Last active
July 2, 2018 14:11
-
-
Save tonysm/8d0da29d5fcd6658e6708c55d42f0d75 to your computer and use it in GitHub Desktop.
Nginx Proxy for Mailcatcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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