From 187872bdba9d6e299862e0a356083fc761b8cdfd Mon Sep 17 00:00:00 2001 From: Dominik Skerhak Date: Fri, 22 Dec 2017 10:52:59 +0100 Subject: [PATCH] Mailhog not working with nginx proxy_pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Websocket configuration added to nginx.conf fixed issue. See: - https://www.nginx.com/blog/websocket-nginx/ - https://github.com/mailhog/MailHog/issues/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 --- Docker/nginx/nginx.conf | 14 ++++++++++++++ docker-compose.yml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Docker/nginx/nginx.conf b/Docker/nginx/nginx.conf index 302359ecd..fec1b57d6 100644 --- a/Docker/nginx/nginx.conf +++ b/Docker/nginx/nginx.conf @@ -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; } @@ -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; } } diff --git a/docker-compose.yml b/docker-compose.yml index 2dac91a95..f062fb306 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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"