|
79 | 79 | |
80 | 80 | events {} |
81 | 81 | |
| 82 | + http { |
| 83 | + upstream stalwart-https { |
| 84 | + # The "stalwart-https" server is a Kubernetes Service exposing Stalwart's HTTPS port to |
| 85 | + # internal sources. |
| 86 | + server stalwart-https:443; |
| 87 | + } |
| 88 | + |
| 89 | + server { |
| 90 | + # --- Dev domain server --- |
| 91 | + server_name *.dev-thundermail.com; |
| 92 | + listen 443 ssl; |
| 93 | + keepalive_timeout 60s; |
| 94 | + proxy_connect_timeout 1s; |
| 95 | +
|
| 96 | + # --- SSL Configuration --- |
| 97 | + # These files are populated as volumes mounted to the pods from secrets drawn from an |
| 98 | + # external secret store. |
| 99 | + ssl_certificate /etc/nginx/dev-thundermail.crt; |
| 100 | + ssl_certificate_key /etc/nginx/dev-thundermail.key; |
| 101 | + ssl_session_cache shared:SSL:10m; |
| 102 | + ssl_session_timeout 10m; |
| 103 | +
|
| 104 | + # Enable gzip compression |
| 105 | + gzip on; |
| 106 | + gzip_types text/html application/json; |
| 107 | + |
| 108 | + # Specifically block access to these routes |
| 109 | + location ^~ /account { # Stalwart's user account settings system, superceded by thunderbird-accounts |
| 110 | + return 404; |
| 111 | + } |
| 112 | + |
| 113 | + location ^~ /admin { # Stalwart's web admin console, only accessible by private route |
| 114 | + return 404; |
| 115 | + } |
| 116 | + |
| 117 | + location ^~ /api { # Stalwart's underlying API system, only accessible by private route |
| 118 | + return 404; |
| 119 | + } |
| 120 | + |
| 121 | + # All other routes are acceptable, and should be proxied to the backend |
| 122 | + location ^~ / { |
| 123 | + proxy_pass https://stalwart-https; |
| 124 | + proxy_set_header Host mail.dev-thundermail.com; |
| 125 | + proxy_ssl_name mail.dev-thundermail.com; |
| 126 | + } |
| 127 | + } |
| 128 | +
|
| 129 | + server { |
| 130 | + # --- Stage domain server --- |
| 131 | + server_name *.stage-thundermail.com; |
| 132 | + listen 443 ssl; |
| 133 | + keepalive_timeout 60s; |
| 134 | + proxy_connect_timeout 1s; |
| 135 | +
|
| 136 | + # --- SSL Configuration --- |
| 137 | + # These files are populated as volumes mounted to the pods from secrets drawn from an |
| 138 | + # external secret store. |
| 139 | + ssl_certificate /etc/nginx/stage-thundermail.crt; |
| 140 | + ssl_certificate_key /etc/nginx/stage-thundermail.key; |
| 141 | + ssl_session_cache shared:SSL:10m; |
| 142 | + ssl_session_timeout 10m; |
| 143 | +
|
| 144 | + # Enable gzip compression |
| 145 | + gzip on; |
| 146 | + gzip_types text/html application/json; |
| 147 | + |
| 148 | + # Specifically block access to these routes |
| 149 | + location ^~ /account { # Stalwart's user account settings system, superceded by thunderbird-accounts |
| 150 | + return 404; |
| 151 | + } |
| 152 | + |
| 153 | + location ^~ /admin { # Stalwart's web admin console, only accessible by private route |
| 154 | + return 404; |
| 155 | + } |
| 156 | + |
| 157 | + location ^~ /api { # Stalwart's underlying API system, only accessible by private route |
| 158 | + return 404; |
| 159 | + } |
| 160 | + |
| 161 | + # All other routes are acceptable, and should be proxied to the backend |
| 162 | + location ^~ / { |
| 163 | + proxy_pass https://stalwart-https; |
| 164 | + proxy_set_header Host mail.stage-thundermail.com; |
| 165 | + proxy_ssl_name mail.stage-thundermail.com; |
| 166 | + } |
| 167 | + } |
| 168 | + |
82 | 169 | http { |
83 | 170 | # --- SSL Configuration --- |
84 | 171 | # These files are populated as volumes mounted to the pods from secrets drawn from an |
|
0 commit comments