|
|
|
@ -10,6 +10,7 @@ events {
|
|
|
|
|
|
|
|
|
|
# Environment variables used in the configuration
|
|
|
|
|
env WEBMAIL;
|
|
|
|
|
env EXPOSE_ADMIN;
|
|
|
|
|
|
|
|
|
|
http {
|
|
|
|
|
# Standard HTTP configuration with slight hardening
|
|
|
|
@ -42,6 +43,7 @@ http {
|
|
|
|
|
|
|
|
|
|
# Load Lua variables
|
|
|
|
|
set_by_lua $webmail 'return os.getenv("WEBMAIL")';
|
|
|
|
|
set_by_lua $expose_admin 'return os.getenv("EXPOSE_ADMIN")';
|
|
|
|
|
|
|
|
|
|
# Actual logic
|
|
|
|
|
|
|
|
|
@ -50,11 +52,19 @@ http {
|
|
|
|
|
proxy_pass http://webmail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($webmail = none) {
|
|
|
|
|
return 403;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location /admin {
|
|
|
|
|
if ($expose_admin = yes) {
|
|
|
|
|
proxy_pass http://admin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($expose_admin != yes) {
|
|
|
|
|
return 403;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|