diff --git a/includes/server/webfinger.php b/includes/server/webfinger.php index 3dc4fb3..fffe108 100644 --- a/includes/server/webfinger.php +++ b/includes/server/webfinger.php @@ -41,7 +41,15 @@ function handle( $query ) { } $account_name = $matches[1]; $account_host = $matches[2]; - if ( $account_host !== $_SERVER['HTTP_HOST'] ) { + $parsed = parse_url( site_url() ); + $site_root = $parsed['host']; + if ( array_key_exists( 'port', $parsed ) && ! empty( $parsed['port'] ) ) { + $site_root = $site_root . ':' . $parsed['port']; + } + if ( array_key_exists( 'path', $parsed ) && ! empty( $parsed['path'] ) ) { + $site_root = $site_root . $parsed['path']; + } + if ( $account_host !== $site_root ) { header( 'HTTP/1.1 404 Not Found', true, 404 ); echo __( 'Resource not found', 'pterotype' ); exit;