Depends on D19192. Ref T4190. Ref T13101. Instead of directly including the proxy endpoint with <img src="..." />, emit a placeholder and use AJAX to make the request. If the proxy fetch fails, replace the placeholder with an error message.
This isn't the most polished implementation imaginable, but it's much less mysterious about errors.