[Mono-list] cannot bind HttpListener to IP address (+ different behavior in mono / .net)
kriss.free at free.fr
Mon Sep 30 20:19:11 UTC 2013
When I bind a HttpListener to a specific IP address, any url with an
hostname corresponding to that IP that I open in a browser returns a "Bad
Request (Invalid host)" in mono whereas it runs fins in .Net.
The long story:
I have a server with two IP addresses. A web server (apache) is bound to the
first IP. I want to make httplistener listen on the second IP 192.168.1.2 to
host two websites example1.com and example2.com. I cannot use
httplistener.Prefixes.Add("http://*:80/") because apache is already
listening on the first IP (this is normal and expected). So I used
httplistener.Prefixes.Add("http://192.168.1.2:80/"). The command runs fine
- with mono, if I open in a browser "http://192.168.1.2" it works, but
"http://www.example1.com" leads to a "Bad Request (Invalid host)".
- with .Net, both url works correctly.
Did I miss something?
The tested platforms:
- Mono 3.2.3 on opensuse 12.3
- .NET 4 on Windows 2008R2
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list