ERR_TOO_MANY_REDIRECTS for image previews


we try to use Nextcloud to serve images and display image previews on a web page. Thumbnail URL example looks like

When you open this URL in the browser directly, you see the thumbnail picture OK. But if it’s used in img tag as src attribute, we get just ERR_TOO_MANY_REDIRECTS error in console.

What is the correct HTML to include Nextcloud image preview to a web page?

More details: when browser tries to download image as IMG SRC, Nextcloud returns 302 and no image. We open the same URL in the browser and see there is a picture. Then we refresh our page and Nextcoud returns an image for IMG SRC with code 200!
That’s a bit strange.

I think you must use the app “SharingPath”. Because the user is in the CDN-path perhaps use a special nextcloud-user for nice path-names instead of “admin” in the example.


I think also this does not work in img-html-code

OK the big question here is: what is the correct way to make a thumbnail URL for an image knowing its ID and preview width/height? It’s NOT for admin so should be accessible without login and used on a webpage as SRC in the image.