Getting two 302 requests to different URLs before finally get the image

jfriendjfriend Registered Users Posts: 8,097 Major grins
edited March 2, 2012 in Bug Reporting
This is a technical report - please direct this to someone who understands Smugmug image redirects.

When this image URL is returned from an API request and then this image is fetched:

http://www.digitalninjadesign.com/photos/i-6B74NvB/0/1080x720/i-6B74NvB-1080x720.jpg

it returns a 302 with a redirect to this image:

http://www.digitalninjadesign.com/photos/i-6B74NvB/0/X2/i-6B74NvB-X2.jpg

When that image is requested, it returns a 302 with a redirect to this image:

http://www.digitalninjadesign.com/photos/i-6B74NvB/0/O/i-6B74NvB.jpg

When that image is requested, it finally gets the image.

The first URL came from an API request to list the images in the gallery with a custom size.

Obviously, it's not very efficient to get two 302 requests before getting the image you want and I doubt that is what is intended. That means it take three roundtrips to get the image you want.

This issue does not only happen on this particular image. I see it on other images in the slideshow on this homepage: http://www.digitalninjadesign.com/. Note, I suspect this issue only happens if the slideshow is large enough to make some of the image requests larger than the some size.
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question

Comments

  • rainforest1155rainforest1155 Registered Users Posts: 4,566 Major grins
    edited March 2, 2012
    Thanks John, I'll pass this on to our QA team to take a closer look.
    In my understanding this doesn't look like a bug as the redirects seem logical to me and the end result is correct (original is just 1080x720 and thus equals our X2 size), but that doesn't mean that this can't be improved.
    Sebastian
    SmugMug Support Hero
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 2, 2012
    Thanks John, I'll pass this on to our QA team to take a closer look.
    In my understanding this doesn't look like a bug as the redirects seem logical to me and the end result is correct (original is just 1080x720 and thus equals our X2 size), but that doesn't mean that this can't be improved.
    But, I doubt the design intent of fetching a URL from the API is that you get two 302 redirects before you get an image. In fact, shouldn't the API give you a URL that requires no 302 redirects? or at least no more than one?

    I can see this happening occasionally if the end user makes up their own URL, but when the source of the URL is your own API, this shouldn't be happening.

    It's 3x the load on your servers and 3x the number of network roundtrips and 1/3 the performance. This would perform horribly on mobile where roundtrips have some latency and are slow.

    In looking at the URLs in a little more detail, it looks like the middle URL of the three shouldn't be happening. The first redirect should return the third URL, not the second URL. Your server has all the logic available to already know that the final URL is the right URL, not the middle URL.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • MSkaffariMSkaffari Registered Users Posts: 147 Major grins
    edited March 2, 2012
    jfriend wrote: »
    But, I doubt the design intent of fetching a URL from the API is that you get two 302 redirects before you get an image. In fact, shouldn't the API give you a URL that requires no 302 redirects? or at least no more than one?

    I can see this happening occasionally if the end user makes up their own URL, but when the source of the URL is your own API, this shouldn't be happening.

    It's 3x the load on your servers and 3x the number of network roundtrips and 1/3 the performance. This would perform horribly on mobile where roundtrips have some latency and are slow.

    In looking at the URLs in a little more detail, it looks like the middle URL of the three shouldn't be happening. The first redirect should return the third URL, not the second URL. Your server has all the logic available to already know that the final URL is the right URL, not the middle URL.

    Indeed this is not ideal for us or you. We'll take a look and improve.
Sign In or Register to comment.