GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/291350

Change subject: Use domain-relative URL for client-side RESTBase requests
......................................................................

Use domain-relative URL for client-side RESTBase requests

Some older browsers have bugs in how they expose response headers from CORS
requests. Additionally, cross-origin requests are slower, as they involve a)
an extra DNS lookup, and b) another connection to be set up.

Users on the mobile domains used to send API requests to the main project
domains, making those requests cross-origin. This patch uses an absolute path
instead, which keeps those requests within the mobile domain.

Bug: T135171
Change-Id: Id5d8e726e1126d6148e1d1dc2869c2e0665155c0
---
M wmf-config/CommonSettings.php
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/50/291350/1

diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 32df79a..871aec9 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -2133,10 +2133,13 @@
                                $wgVisualEditorRestbaseURL, 
$wgVisualEditorFullRestbaseURL;
                        if ( $wmfRealm === 'production' ) {
                                $wgVisualEditorRestbaseURL = 
"https://$wgServerName/api/rest_v1/page/html/";;
-                               $wgVisualEditorFullRestbaseURL = 
"https://$wgServerName/api/rest_";;
+                               // Use domain-relative URLs to avoid the need 
for
+                               // cross-domain API requests on mobile domains. 
Those are
+                               // slower & buggy in some older browsers (see 
T135171).
+                               $wgVisualEditorFullRestbaseURL = "/api/rest_";
                        } elseif ( $wmfRealm === 'labs' ) {
                                $wgVisualEditorRestbaseURL = 
"//$wgServerName/api/rest_v1/page/html/";
-                               $wgVisualEditorFullRestbaseURL = 
"//$wgServerName/api/rest_";
+                               $wgVisualEditorFullRestbaseURL = "/api/rest_";
                        }
                };
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/291350
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5d8e726e1126d6148e1d1dc2869c2e0665155c0
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: GWicke <gwi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to