diff --git a/js/lib/mediawiki.ApiRequest.js b/js/lib/mediawiki.ApiRequest.js
index <HASH>..<HASH> 100644
--- a/js/lib/mediawiki.ApiRequest.js
+++ b/js/lib/mediawiki.ApiRequest.js
@@ -560,12 +560,16 @@ function ParsoidCacheRequest ( env, title, oldid, options ) {
 		timeout: 60 * 1000, // 60 seconds: less than 100s VE timeout so we still finish
 		headers: {
 			'User-Agent': userAgent,
-			'Cookie': env.cookie,
 			'Connection': 'close',
 			'x-parsoid-request': 'cache'
 		}
 	};
 
+	if (env.cookie) {
+		// Forward the cookie if set
+		this.requestOptions.headers.Cookie = env.cookie;
+	}
+
 	if (!options.evenIfNotCached) {
 		// Request a reply only from cache.
 		this.requestOptions.headers['Cache-control'] = 'only-if-cached';
Only set cookie header on API requests when one was passed in

We don't send Vary: Cookie headers ourselves, but it seems to be well possible
that our Varnish config (by using various MW defaults) varies on cookies by
default. That would explain the cache misses on selser that we are seeing in
production.

Change-Id: Id<I>fce<I>c<I>b<I>a9c<I>cf4bdd<I>e<I>