Page MenuHomePhabricator

How to get ThumbnailGuessing not to generate 404 so that it can work with CDN?
Closed, DuplicatePublic

Description

When accessing a remote file on a common share wiki, with sutation that send phrase request directly to that wiki is not possible, guessing url is used.

Apache/Nginx redirect were set on the remote wiki, and the first non-exist thumb request will be handle well.

However, the first request will return a 404 response and it will get cached by CDN, which made all the rest visitor can't view that image thumb anymore. How to config the thumb.php work around to get it not to return 404? If this is not possible, then how can I avoid caching 404 by CDN when using MultimediaViewer?

wgMediaViewerUseThumbnailGuessing = true;

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/[^/]+/[^/]+$ /w/thumb_handler.php [L,QSA]

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This is not a configuration issue; it's a bug. (T27958: thumb.php should work with ForeignAPIRepo; see also T69056#799964) Short of fixing that, or disabling 404 caching, or thumbnail guessing, not sure if there is anything you can do about it.

With these two posts, I understand that this bug does not affect commons wikimedia (where all machine have access to files).

A temporary workaround on nginx may stop this error. However, we tried the 404 no-cache solution. It seems the CDN we use ignored that no-cache header.

We disabled thumbnail guessing, and this setting significantly affect image loading speed, which made user unhappy.

Hope this bug get fix soon.

Merging in as duplicate of T27958: thumb.php should work with ForeignAPIRepo. Recommendation for third party wiki is to set specific CDN's anti-caching headers as appropriate.