Imgur images not embedding with 429 error

Just download remote images to local is disabled.

1 Like

Had it always been set? What if you rebuild html on the posts that have the imgur images?

Oh! And itā€™s discourse thatā€™s getting the error and not your local browser?

Yep.

It happens as early as in the post editor, when pasting an Imgur link it tries to create a Onebox in the post preview but fails with a oneboxed 429 error that Discourse injects into the post preview.

As I understand it, my Discourse server first tries to validate the naked image URL and hits Imgur, which in turn eventually rejected my serverā€™s domain / IP because of many requests. Then Discourse fails to wrap the URL in <img> tags because it couldnā€™t validate the image, and it just leaves the naked URL in the post.

As of now the problem seems to have resolved on my server, i.e. Imgur has removed the rate limit, for now. Iā€™m sure it wonā€™t be the last time though, so this issue remains.

Ah! I see. Then I think you need a plugin, or maybe a theme component that will handle those images without sending the request.

hello, Iā€™m using google translate to understand the conversation, but it wasnā€™t clear to me (maybe itā€™s a translation without literal meaning) How did you solve the problem?

There is no solution yet. Imgur blocks Discourse from displaying the image preview, and Discourse does not properly handle that error and fails to create the proper HTML to display the image.

As a workaround:

1 Like

What language is your native language so I can translate that part of the conversation?

iā€™m not clear why you are implying Discourse is responsible for handling an error because Imgur is blocking images. this is an Imgur thing, not a discourse functional weakness or bug. it sounds like you may need a plug-in built to handle this if you need to have imgur photos.

2 Likes

Discourse should still generate valid HTML to display the image. Imgur throws a 429 error when the Discourse server tries to pull a preview of the image link, but Discourse treats it as if it were a 404 error. On my forum this image is not displayed with just the URL:
https://i.imgur.com/eHltaVt.jpeg

But the following HTML works to display the image:
<img src="https://i.imgur.com/eHltaVt.jpeg">
That is what Discourse should generate for the baked post even if it receives a 429 when the server hits the URL, and it should only leave the naked URL if it gets a 404 error.

2 Likes

This problem is still continuing to affect my Discourse forum.
@community-moderators Would it be possible to move this to bug , or copy the last post into a new topic? (Of course I can do that myself too if you think thatā€™s best.)

2 Likes

That suggests that your server has been rate limited and canā€™t get images from imgur. Links to the images worry because they are retrieved by the user and not your server.

2 Likes

The server is indeed getting rate limited when it tests the Imgur link and tries to Onebox it. But thereā€™s nothing preventing individual users from viewing it when the link is properly wrapped in <img> tags. The problem is that Discourse is assuming that the link is not a viewable image for all users when in reality itā€™s only a problem for the server, and itā€™s just wrapping the Imgur URL in in <a> tags.

2 Likes

Iā€™m not sure it classifies as a bug though I understand the annoyance :thinking:
If you have figured out that this is indeed the issue, I invite you to post a new topic with a proper description of the issue in feature and see how it goes :slight_smile:

2 Likes

Thanks @Canapin .

2 Likes

digging out this one
We have the same issue with Imgur, embed not working.
In the composer preview, following error message appears:

Sorry, we were unable to generate a preview for this web page, because the web server returned an error code of 429. Instead of a preview, only a link will appear in your post.

example link: How To: Quickstop - FAQs & How-tos - pev.dev (scroll to bottom of first post)

Hi @drreen :slight_smile:

Your post seemed to fit better in this topic, so Iā€™ve moved it across. :+1:

1 Like