Images break with wrong href; clearing caches fixes! Occasionally we will have graphics in various places on the site that are missing because of incorrect hrefs with unknown subdomains and are fixed when the caches are cleared. So an incorrect link

https://www.xfdg.oursite.com/sites/image.jpg

is only fixed after cache clear

(correct https://www.oursite.com/sites/image.jpg)

We are also seeing results in Google that have weird unknown subdomain URLs, in the same manner as the image URLs.

I had read in https://www.drupal.org/node/1992030 “Protecting against HTTP HOST Header attacks (prevent your site from thinking it is someone else)” that it could be spam or errors with Drupal’s cron could be responsible.

Any ideas or directions?
More than likely, your server is responding to multiple domain names, either by being the default or matching/wildcards for ServerName and ServerAlias (using Apache terminology here; nginx and IIS have similar concepts).

So, the problem is that you get a request to www.example.com, and Drupal serves that page up and uses that URL as the base.  It will also respond to www.subdomain.example.com and use that as the URL base.  The problem you see is that the subdomain request is the one being cached, and the hostname isn't part of the cache ID.

The general solution to this is to set up a canonical redirect in either the Apache config or the .htaccess file for your site (I prefer in server config).  The rule would look something like this

&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
&lt;/IfModule&gt;


When you do that, Apache will redirect everything to https://www.example.com.  Over time, Google will fix its indexes because of the 301 redirect, or you can try to submit manual delists.