domain="yourdomain.com"
ext_if="egress"
server $domain {
listen on $ext_if port 80
block return 301 "https://$domain$REQUEST_URI"
}
server $domain {
listen on $ext_if tls port 443
}
Currently it doesn't substitute $domain inside URI, so it ends up redirecting to literally "$domain$REQUEST_URI" instead of redirecting to "yourdomain.com$REQUEST_URI".
I've checked both OpenBSD 5.7 release version of httpd(8) and the current one.
Thanks! Makes it much cleaner. I'll close this one for now and, if I'll ever patch server_expand_http() function to support configuration variables, I'll send it to tech.
Consider the following configuration file:
Currently it doesn't substitute
$domain
inside URI, so it ends up redirecting to literally "$domain$REQUEST_URI" instead of redirecting to "yourdomain.com$REQUEST_URI".I've checked both OpenBSD 5.7 release version of httpd(8) and the current one.
Is it an appropriate behaviour?