Skip to content

Commit

Permalink
Mailhog not working with nginx proxy_pass
Browse files Browse the repository at this point in the history
Websocket configuration added to nginx.conf fixed issue.

See:

- https://www.nginx.com/blog/websocket-nginx/
- mailhog/MailHog#117

Also fixed ENV variable for MailHog. Should be HOSTNAME. More-less just
cosmetic change - used for EHLO/HELO & mail header. Default value is
mailhog.example.

remp/remp#149
  • Loading branch information
markoph committed Dec 22, 2017
1 parent 38cf175 commit 187872b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ server {
}
}

# Required by websocket configuration (see mailhog server configuration)
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

upstream mailhog.remp.press {
server mailhog:8025;
}
Expand All @@ -131,5 +137,13 @@ server {

location / {
proxy_pass http://mailhog.remp.press;

# Websocket configuration
# See:
# - https://www.nginx.com/blog/websocket-nginx/
# - https://github.com/mailhog/MailHog/issues/117
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
mailhog:
image: "mailhog/mailhog:v1.0.0"
environment:
MH_domainname: "mailhog.remp.press"
MH_HOSTNAME: "mailhog.remp.press"

adminer:
build: "./Docker/php"
Expand Down

0 comments on commit 187872b

Please sign in to comment.