Search…

X3 Photo Gallery Support Forums

Search…
 
seldor
Topic Author
Posts: 8
Joined: 24 Oct 2022, 15:27

X3 mixes various domains

13 Nov 2022, 11:15

Until recently, I had multiple domain names as aliases where I ran my X3 gallery (now I've changed them all to 301 to the main domain).
Then I noticed that apparently, X3 seemed to cache some domain names. For example, suddenly the sitemap, when called via  https://domain/sitemap contained links to https://aliasdomain/ instead. And the links to the RSS feeds on the pages contained links to https://yetanotherdomain/feed/ .
Since I never configured those domains anywhere in X3 it seems that such things were cached somewhere? But even deleting the page cache didn't change anything.
Finally I set the "Force URL" parameter to my main domain and those links were correct again.
For me, this may well be a final solution since I only ever intend to use my main domain, but it appears that it is some kind of bug in X3 that this may happen.
I'd expect the sitemap and the RSS/Atom links to always reflect the current domain the site was called from, and not some other domain name X3 seems to have seen sometime in the past.
Thanks
Matt
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: X3 mixes various domains

13 Nov 2022, 12:54

X3 does not "cache domain names". But X3 pages will get cached with responses based on the domain they were accessed from. If you have multiple domains that access the same website, that means you can have cached pages with responses matching different website domains. This is why it's recommended to consolidate and redirect your efforts to a single domain, as noted in this post:
viewtopic.php?f=62&t=9080

If you have now setup 301 redirects towards a single primary domain, and it's working properly (also across https and www/non-www), all future cache will get created from the single primary domain. To force cache refresh, you could click "SAVE" in panel settings, which will cause all page cache to invalidate, and new cache will get created from the domain they are accessed from ... After all, X3 can't create cache from domains it doesn't know about and if nothing is requested from those domains. These "page cache" fragments include XML sitemap and feed output, so they will also get recreated from the domain they were requested from (until cache again is invalidated).
Matt wrote:I'd expect the sitemap and the RSS/Atom links to always reflect the current domain the site was called from, and not some other domain name X3 seems to have seen sometime in the past.
It caches from the first domain that requests a NEW output (after cache was invalidated, because something changed). If you want dynamic output based on different domains, it would mean we couldn't really use cache. Besides, I don't see why this would be useful ... There is no benefit for you or anyone else that you have one and the same website scattered around multiple domains ... Or sitemaps that tell Google that one single page exists randomly on multiple domains.

I don't see any bug here. If you have setup all redirects correctly, and invalidated cache, all pages will get created and cached from the single primary domain.
Matt wrote:But even deleting the page cache didn't change anything.
You mean from the panel? Any CHANGE from X3 panel, will automatically cause pages to get refreshed from the next domain they get requested from ... Because making changes in the X3 panel, is when your X3 website changes. The only other reason why pages would remain stale, is if the redirects are not working properly, or you have some network mechanism or CDN (like Cloudflare) that is caching page output.
Matt wrote:Finally I set the "Force URL" parameter to my main domain and those links were correct again.
This can be used, but it doesn't have any effect if you already have working redirects, because that's basically what it does. The only difference is that it can only make redirects to requests that X3 controls (basically your X3 website) ... It can't redirect requests made to other apps or resources, unlike if you setup real redirect in .htaccess or server config.

If you want me to diagnose this further, I would need to see real links.
 
seldor
Topic Author
Posts: 8
Joined: 24 Oct 2022, 15:27

Re: X3 mixes various domains

13 Nov 2022, 16:00

Ok thanks for the explanation. Doesn't quite explain to me why deleting the cache didn't help with that (the links for atom/RSS and the sitemap then still pointed to the 'wrong' domains) but works for me, now that I've fixed all the redirects and forced the domain. It was just unexpected to me and leads to really strange cross-domain behaviour in case someone has the same setup (whether such a setup is considered good or bad is just another point); I kinda expected that the caching would not also cache the domain names itself, but for me it is fixed and thus I cannot test anymore whether or not there is a caching issue with the 'delete cache' function (from the panel).

Thanks though for all the detailed explanations
Matt
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: X3 mixes various domains

13 Nov 2022, 22:38

seldor wrote:Doesn't quite explain to me why deleting the cache didn't help with that (the links for atom/RSS and the sitemap then still pointed to the 'wrong' domains)
I can't say from here why that was. XML feeds (sitemap/feed) have +4 hours "cache" time, so it's possible they were temporarily cached in browser or network, which is unrelated to the X3 cache.
seldor wrote:leads to really strange cross-domain behaviour in case someone has the same setup
In most cases, X3 uses root-relative links (/page/here/ etc), and domain is therefore irrelevant. However, for things like sitemap and feed, we need to generate absolute links that include the domain name. These links therefore get generated on the first domain request that creates the cache.
seldor wrote:I kinda expected that the caching would not also cache the domain names itself
It doesn't actually "cache the domain names". It just caches output, and in your sitemap, the output needs to contain absolute links that contain the domain. If we didn't do that, we would have to disable cache for these responses, but that wouldn't be useful to anyone.

Anyway, thanks for posting about this, and glad it's resolved!