Hi all, I'm trying to set up httpd to do an apex->www redirect, and it works except for the fact that other subdomains also get redirected. It seems as if 'server "pnnk.org"' matches any subdomain.
DNS: pnnk.org. A 192.30.33.33 phoenix A 192.30.33.33 mail A 192.30.33.33 www CNAME phoenix pnnk.org. MX mail $ cat /etc/httpd.conf server "pnnk.org" { listen on * port 80 listen on :: port 80 block return 301 "http://www.pnnk.org" } server "www.pnnk.org" { listen on * port 80 listen on :: port 80 } Here's an example of the problem. I expected this to fail, not redirect: $ telnet mail.pnnk.org 80 Trying 192.30.33.33... Connected to mail.pnnk.org. Escape character is '^]'. GET / HTTP/1.1 Host: mail.pnnk.org HTTP/1.0 301 Moved Permanently Date: Thu, 05 May 2016 13:21:19 GMT Server: OpenBSD httpd Connection: close Content-Type: text/html Content-Length: 374 Location: http://www.pnnk.org <!DOCTYPE html> <html> <head> <title>301 Moved Permanently</title> <style type="text/css"><!-- body { background-color: white; color: black; font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif; } hr { border: 0; border-bottom: 1px dashed; } --></style> </head> <body> <h1>301 Moved Permanently</h1> <hr> <address>OpenBSD httpd</address> </body> </html> Connection closed by foreign host. Is there something I can do to get the behavior I expect? Thanks, Alex p.s. I apologize if my message shows up more than once, I had an issue with my mail setup but I think it's fixed now.