Use actual site root for webfinger discovery
This commit is contained in:
parent
aade3e62ac
commit
7161cb4ebe
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user