Skip to content

Commit 57b830e

Browse files
committed
reject unexpected nginx host headers
1 parent 13ddad2 commit 57b830e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎services/nginx/etc/nginx/sites-available/main-ssl.conf.template‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ server {
1313

1414
server_name __MAIL_HOSTNAME__ __WIREGUARD_BIND_IPV4__ 127.0.0.1;
1515

16+
# Reject unexpected Host headers instead of serving the default HTTPS
17+
# application surface for arbitrary hostnames.
18+
if ($host !~ ^(__MAIL_HOSTNAME__|__WIREGUARD_BIND_IPV4__|127\.0\.0\.1)$) {
19+
return 421;
20+
}
21+
1622
# Default root for this vhost (inside chroot /var/www)
1723
# /htdocs is /var/www/htdocs on the real filesystem
1824
root /htdocs;

0 commit comments

Comments
 (0)