Matches requests from host that is equal to application's default_host. Always returns no match if ``X-Real-Ip`` header is present.
| 533 | |
| 534 | |
| 535 | class DefaultHostMatches(Matcher): |
| 536 | """Matches requests from host that is equal to application's default_host. |
| 537 | Always returns no match if ``X-Real-Ip`` header is present. |
| 538 | """ |
| 539 | |
| 540 | def __init__(self, application: Any, host_pattern: Pattern) -> None: |
| 541 | self.application = application |
| 542 | self.host_pattern = host_pattern |
| 543 | |
| 544 | def match(self, request: httputil.HTTPServerRequest) -> Optional[Dict[str, Any]]: |
| 545 | # Look for default host if not behind load balancer (for debugging) |
| 546 | if "X-Real-Ip" not in request.headers: |
| 547 | if self.host_pattern.match(self.application.default_host): |
| 548 | return {} |
| 549 | return None |
| 550 | |
| 551 | |
| 552 | class PathMatches(Matcher): |