Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Kestrel support urls/hostnames, or it can only listen to a port?

I'm trying to start ASP.NET 5 web application so that it could be accessible via public internet address, like "http://hostname.dom".

I don't want it to be acessible via "http://www.hostname.dom", "http://test.hostname.dom", etc. And I have DNS records configured to point server's ip address by "*.hostname.dom" and "hostname.dom" names.

So I start Kestrel with the parameter:

server.urls=http://hostname.dom

I expect it to ignore any address that is not "http://hostname.dom", but application is available by every "http://justanything.hostname.dom" address and even just by IP address. So it is listening for all requests to 80 port rather than requests to a specific hostname. For example, when configuring IIS site bindings, you can specify binding like "hostname.dom" and it will ignore any other possible prefixes until you specify them explicitly.

Does Kestrel support urls/hostnames, or it can only listen to a port?

like image 476
yaapelsinko Avatar asked Oct 28 '25 15:10

yaapelsinko


1 Answers

Well yes, Kestrel doesn't support hostname listening. Only ip:port binding. To make it possible, you, my friend, either must use another hosting solution (like WebListener, if running on Windows) or configure forwarding with a webserver: http://druss.co/2015/06/asp-net-5-kestrel-nginx-web-server-on-linux/

like image 65
yaapelsinko Avatar answered Oct 31 '25 12:10

yaapelsinko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!