OGProxy - a replacement for iFramely
-
@DownPW Looks ok for the most part, but this looks like it’s truncated?
return { ...ogsResult, metaProperties: metadata, faviconUrl: faviconB64, }; } -
@DownPW Looks ok for the most part, but this looks like it’s truncated?
return { ...ogsResult, metaProperties: metadata, faviconUrl: faviconB64, }; }@DownPW Looks ok for the most part, but this looks like it’s truncated?
return { ...ogsResult, metaProperties: metadata, faviconUrl: faviconB64, }; }exactly, i must see the code, i tell you soon
-
I was experiencing 500 (Internal Server Error) responses from the proxy, visible in the browser console:
GET https://proxy.xxx-xxx.net/ogproxy?url=https%3A%2F%2Fzupimages.net%2Fup%2F26%2F16%2Fld8h.jpg 500 (Internal Server Error)After investigation, I found two root causes:
1. Direct image URLs being sent to the proxy
The custom JavaScript responsible for detecting links and sending them to the proxy was using the following regex to exclude direct image links:
var fileExtensionPattern = /\.(png|jpeg|gif|pdf|docx?|xlsx?|pptx?|zip|rar|svg)$/i;Note that .jpg and .webp were missing from the pattern. As a result, links ending in .jpg were not recognized as direct image URLs and were forwarded to the OGProxy, which then tried to scrape them as web pages using open-graph-scraper — causing a 500 error.
The fix was to add the missing extensions:
var fileExtensionPattern = /\.(jpg|png|jpeg|gif|pdf|docx?|xlsx?|pptx?|zip|rar|svg|webp)$/i;2. The proxy not following HTTP redirects
Some image hosting services (e.g. zupimages.net) return a 301 redirect from the bare domain to www. When curl follows the redirect manually the image loads fine:
curl -IL https://zupimages.net/up/26/16/ld8h.jpg HTTP/2 301 → https://www.zupimages.net/up/26/16/ld8h.jpg HTTP/2 200However, the proxy’s axios.get() call does not handle this gracefully when open-graph-scraper is involved, resulting in a 500 error being returned to the client.
My questions are:
- Is there a known best practice for handling redirect chains in open-graph-scraper?
- Would passing maxRedirects or followRedirect options explicitly to axios or ogs fix this reliably?
- Is there a cleaner way to pre-filter direct image/file URLs before they reach the proxy, ideally at the NodeBB plugin level rather than in custom JS?
Thanks in advance.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginRelated Topics
-
-
-
-
-
-
Link Not Working
Solved Customisation -
-