Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between http://+:8080/ and http://*:8080/

What are the differences between these two prefixes in terms of HttpListener or any other?

http://+:8080/

http://*:8080/
like image 727
Pankaj Avatar asked Feb 27 '12 03:02

Pankaj


2 Answers

http://*:8080/: Receive all HTTP requests on port 8080 that are not already being handled by some other HttpListener.

http://+:8080/: Receive all HTTP requests on port 8080 even if they're already handled by another HttpListener.

like image 126
Paul Avatar answered Oct 12 '22 07:10

Paul


In addition to @Paulpro's great answer, the link posted by @rownage (see this answer) provides some more information about the difference:

Strong wildcard (Plus Sign +)

When the host element of a UrlPrefix consists of a single plus sign (+), the UrlPrefix matches all possible host names in the context of its scheme, port and relativeURI elements, and falls into the strong wildcard category.

A strong wildcard is useful when an application needs to serve requests addressed to one or more relativeURIs, regardless of how those requests arrive on the machine or what site they specify in their Host headers. Use of a strong wildcard in this situation avoids the need to specify an exhaustive list of host and/or IP-addresses.

Weak wildcard (Asterisk *)

When an asterisk (*) appears as the host element, then the UrlPrefix falls into the weak wildcard category. This kind of UrlPrefix matches any host name associated with the specified scheme, port and relativeURI that has not already been matched by a strong-wildcard, explicit, or IP-bound weak-wildcard UrlPrefix.

This host specification can be used as a default catch-all in some circumstances, or can be used to specify a large section of URL namespace without having to use many UrlPrefixes.

like image 43
CodeFox Avatar answered Oct 12 '22 08:10

CodeFox