Clean WordPress 4.8.1 install with Akismet 3.3.4, Jetpack 5.2.1, qTranslate-X 3.4.6.8
Disabled Little Snitch (firewall) still persists.


Deactivating qTranslate-X fixed the issue. Plugin rewrote the URL. How could we prevent it? API URL should not be translated
@ebinnion I'm tagging you since you are neck deep with language plugins.
@mikaelz My first thought is this may be a bug with the other plugin since we just ask Core for the REST API URL.
What I don't understand now is what/when is changing the REST API URL idcL10n.apiRoot

At https://github.com/Automattic/jetpack/blob/5.2.1/_inc/idc-notice.js#L99 the URL is good.
AJAX response triggers error https://github.com/Automattic/jetpack/blob/5.2.1/_inc/idc-notice.js#L117
The AJAX URL gets redirected

It's at https://github.com/qTranslate-Team/qtranslate-x/blob/3.4.6.9/qtranslate_core.php#L91 via the plugins_loaded action hook https://github.com/qTranslate-Team/qtranslate-x/blob/3.4.6.9/qtranslate_core.php#L140
Upstream already notified https://github.com/qTranslate-Team/qtranslate-x/issues/489
Hi @mikaelz thanks for opening this issue. You can solve this on your installation now with this filter:
<?php
function jetpack_no_qtranslate_rest_url_redirect( $url_lang, $url_orig, $url_info ) {
if ( false !== strpos( $url_info['wp-path'], 'wp-json/jetpack' ) ) {
return false;
}
return $url_lang;
}
add_filter( 'qtranslate_language_detect_redirect', 'jetpack_no_qtranslate_rest_url_redirect', 10, 3 );
It will check if the url is a REST one, and if so, returning false will prevent the redirection.
We'll introduce https://github.com/Automattic/jetpack/pull/7612 in 5.3 which will solve this.
Thanks @eliorivero. Checked the solution in the mentioned PR and I like it. Didn't know why the 3rd-party dir exists. Learned something new today :)