I’ve set up Discourse Connect SSO using the official plugin, so my WP users log into Discourse without registering another user over there. It all works fine, except every single WP dashboard (admin area) request is slowed by 10s due to a timeout I’ve discovered only via Query Monitor plugin.
https://{our-forum-address}/site.json cURL error 28: Connection timeout after 10001 ms
WPDiscourse\Admin\MetaBox->discourse_request()
wp-content/plugins/wp-discourse/lib/plugin-utilities.php:516
WPDiscourse\Admin\MetaBox->get_discourse_categories()
wp-content/plugins/wp-discourse/lib/plugin-utilities.php:273
WPDiscourse\Admin\MetaBox->setup_options()
wp-content/plugins/wp-discourse/admin/meta-box.php:49
do_action('admin_init')
wp-includes/plugin.php:517
Plugin: wp-discourse
Even if it worked, why is there a need for a call like this in the first place? How can I disable it?
Forum and site are on separate servers. There is no Cloudflare. SSL is letsencrypt. It didn’t have this problem on staging. I moved to live, created a new API key and secret, trying to resolve this but it didn’t work.
The plugin says You are not connected to Discourse. Check that your connection settings are correct. If the issue persists, enable connection logs and check Logs. …but I am, as users are able to seamlessly log in to the forum by just clicking on a link containing its address.
The logs in WP say:
[2024-10-31 10:54:47] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":"","http_body":""}
I thought that weird WP security thing cripples it, so I added this but no joy either:
add_filter('http_request_host_is_external', [$this, 'mark_discourse_api_url_external'], 10, 3);
function mark_discourse_api_url_external($is_external, $host, $url)
{
if ($host === "{our-forum-address}") {
return true; // Allow the request by indicating the host IS external
}
return $is_external;
}