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

前端 未结 2 1431
终归单人心
终归单人心 2020-12-20 16:53

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

http://+:8080/

http://*:8080/
相关标签:
2条回答
  • 2020-12-20 16:55

    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.

    0 讨论(0)
  • 2020-12-20 17:16

    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.

    0 讨论(0)
提交回复
热议问题