Skip to content
Browse files

[bugfix] Do not cache invalid WM(T)S responses

The problem here was that in case of http->https redirect
from a misconfigured server (that advertizes http and then
redirects all request to https) all http redirect requests
were cached, making all subsequent requests to the same
url hit the 301 Moved Permanently reponse page intead of
the redirected content.

Fixes #16427 WMTS rendering problems in 2.18 and Master
  • Loading branch information
elpaso committed Oct 3, 2017
1 parent 22d4d22 commit d102404b5e6796727c0ae0c983cf016ab33ff27a
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/providers/wms/qgstilecache.cpp
@@ -48,9 +48,12 @@ bool QgsTileCache::tile( const QUrl &url, QImage &image )
image = QImage::fromData( imageData );

// cache it as well (mutex is already locked)
sTileCache.insert( url, new QImage( image ) );

return true;
// Check for null because it could be a redirect (see: )
if ( ! image.isNull( ) )
sTileCache.insert( url, new QImage( image ) );
return true;
return false;

0 comments on commit d102404

Please sign in to comment.
You can’t perform that action at this time.