I thought it would be pretty cool if I could use WebKit to connect to an IP address and send a custom host header to tell the server which site I want to see. Apparently, Apple has better ideas.
NSURL *myURL = [[NSURL alloc] initWithScheme:@"http" host:@"127.0.0.1" path:@"/index.html"];
NSMutableURLRequest *myRequest = [[NSMutableURLRequest alloc] initWithURL:myURL];
[myRequest setValue:@"www.apple.com" forHTTPHeaderField:@"Host"];
When I screw up the last line, say, by adding a colon after "Host" Apache complains about a malformed Host header.
When I don't screw it up, WebKit seems to ignore it completely and I get the default web site (Verified by my phpinfo.php page which lists $_SERVER["HTTP_HOST"] as "127.0.0.1").
I really hope someone can offer some insight into this problem and how to fix it, because I am at a loss.
Thanks,
Andy Kvochick