Page MenuHomePhabricator

CdnCacheUpdate defaults to port 1080 on MediaWiki >= 1.35
Open, Needs TriagePublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Set $wgCdnServers[] to an IP address or hostname with no port specified
  • Trigger a CdnCacheUpdate

What happens?:

cURL attempts to connect to the CDN server on port 1080.

What should have happened instead?:

cURL attempts to connect to the CDN server on port 80.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

This is because the SquidPurgeClient that was in use defaulted to port 80. With the change to using MultiHttpClient for T250417, we now use cURL, and pass the $wgCdnServer as the proxy parameter. cURL defaults to port 1080 if no port is specified.

Event Timeline

I suspect the simplest fix would be to append :80 to what we pass to cURL if the server doesn't contain a port already.

I just found this bug report. I'd always been confused why I'd never see any PURGE requests coming into my wiki web servers' Varnish processes (via varnishlog -q 'ReqMethod eq PURGE'), and why I was seeing port 1080 instead of the expected 80 when viewing page purges through tcpdump. I can confirm that adding :80 to each of the IP addresses in my $wgCdnServers setting does indeed resolve the problem for me.

Notes: See also https://www.mediawiki.org/wiki/Topic:Wgai3z6vhfr9sq4m., I have updated the documentation for the wgCdnServers manual page.

The comments in MainConfigSchema.php still also say that port 80 is the default for CdnServers:
https://github.com/wikimedia/mediawiki/blob/master/includes/MainConfigSchema.php#L4434