reyk / httpd

OpenBSD httpd
Other
314 stars 31 forks source link

Confusing parse.y variable behaviour inside redirects #42

Closed lukateras closed 9 years ago

lukateras commented 9 years ago

Consider the following configuration file:

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.

Is it an appropriate behaviour?

mischapeters commented 9 years ago

Try: https://$SERVER_NAME$REQUEST_URI

lukateras commented 9 years ago

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.