From 3409dc52723d63b790756762ec01c7f137a30440 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Tue, 20 Dec 2016 16:46:20 +0100 Subject: [PATCH] build: Karma proxy should convert Host header By default the Karma proxy does requests against 'localhost', however if the target wiki server has strict host validation (e.g. multiple virtual hosts or otherwise strictly verified) then requests may fail since load.php is not found. An example is with MW_SERVER=devwiki.local. MediaWiki-Vagrant and Wikimedia CI are not affected since they use 'localhost' as the virtual host. Set Karma proxy to change the hostname accordingly. Reference: https://github.com/karma-runner/karma/issues/1729 https://github.com/karma-runner/karma/commit/ae05ea4 Bug: T153757 Change-Id: I317d5686aecd1fb6cf6921cdca77670cded85607 --- Gruntfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 55b7932f00..7b3af54c95 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -14,7 +14,10 @@ module.exports = function ( grunt ) { grunt.loadNpmTasks( 'grunt-karma' ); grunt.loadNpmTasks( 'grunt-stylelint' ); - karmaProxy[ wgScriptPath ] = wgServer + wgScriptPath; + karmaProxy[ wgScriptPath ] = { + target: wgServer + wgScriptPath, + changeOrigin: true + }; grunt.initConfig( { eslint: { -- 2.20.1