Skip to content

Fix og:image URL rewriting in proxy route#475

Merged
cowboyd merged 1 commit intoproductionfrom
fix-proxy-og-image-rewrite
Apr 7, 2026
Merged

Fix og:image URL rewriting in proxy route#475
cowboyd merged 1 commit intoproductionfrom
fix-proxy-og-image-rewrite

Conversation

@cowboyd
Copy link
Copy Markdown
Member

@cowboyd cowboyd commented Apr 7, 2026

Motivation

Blog post og:image URLs were being mangled during proxy rewriting, causing
staticalization to crash with 404 errors. For example, an upstream og:image at
https://effection.deno.dev/blog/<post>/meta-effection.png?w=2400&h=1260 was
being rewritten to http://localhost:8005/effection/meta-effection.png?w=2400&h=1260,
losing the blog/<post>/ path segment entirely.

Approach

Replace target.origin instead of target.href when rewriting meta content
attributes in the proxy route. Using target.href replaced the full page URL
(including path) with the base prefix, which collapsed intermediate path
segments. Using target.origin replaces only the scheme+host+port, preserving
the full resource path.

Replace target.origin instead of target.href when rewriting meta content
attributes so that the full resource path is preserved. Previously, blog
post og:image URLs like /blog/<post>/image.png were collapsed to
/effection/image.png, causing 404s during staticalization.
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 7, 2026

Deploy Preview for frontside canceled.

Name Link
🔨 Latest commit 32abe0a
🔍 Latest deploy log https://app.netlify.com/projects/frontside/deploys/69d542da114d3d000883ae35

@cowboyd cowboyd merged commit caeb772 into production Apr 7, 2026
7 checks passed
@cowboyd cowboyd deleted the fix-proxy-og-image-rewrite branch April 7, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants