summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@jots.org>2026-06-16 18:43:26 +0000
committerKen D'Ambrosio <ken@jots.org>2026-06-16 18:43:26 +0000
commita0803c8e87f375b1f138c7d1650ba21108f1cc62 (patch)
treeb523e79df910999effae48a5fb1af9736308e62a
parentbe80a08c6a2a330e81d43fbfd345f05199e75947 (diff)
Fix WhatsApp/OG link previews: https URLs and correct image dimensions
nginx was sending X-Forwarded-Proto: http (its own scheme) rather than https (the edge scheme), so og:url and og:image were http:// URLs. Fixed by hardcoding https in the nginx proxy_set_header since HTTPS is always terminated at the upstream Apache router. Added a 1200x630 landscape og-default.png (WhatsApp requires ~1.91:1 ratio) and explicit og:image:width/height meta tags. Also tracks the nginx site config in the repo. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--config/nginx-albumen.conf6
-rw-r--r--public/img/og-default.pngbin0 -> 923506 bytes
-rw-r--r--views/layout.erb4
3 files changed, 8 insertions, 2 deletions
diff --git a/config/nginx-albumen.conf b/config/nginx-albumen.conf
index d540bcd..ce143f3 100644
--- a/config/nginx-albumen.conf
+++ b/config/nginx-albumen.conf
@@ -2,6 +2,10 @@ server {
listen 80;
server_name albumen.jots.org;
+ # Apache reverse proxy on the router passes X-Forwarded-For with the real client IP.
+ real_ip_header X-Forwarded-For;
+ set_real_ip_from 192.168.10.1;
+
client_max_body_size 0; # no limit for large video uploads via rsync
proxy_read_timeout 300s;
proxy_send_timeout 300s;
@@ -12,7 +16,7 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Proto https;
proxy_buffering off;
}
}
diff --git a/public/img/og-default.png b/public/img/og-default.png
new file mode 100644
index 0000000..c52525a
--- /dev/null
+++ b/public/img/og-default.png
Binary files differ
diff --git a/views/layout.erb b/views/layout.erb
index 7069e76..d02a67a 100644
--- a/views/layout.erb
+++ b/views/layout.erb
@@ -8,7 +8,9 @@
<meta property="og:url" content="<%= request.url %>">
<meta property="og:title" content="<%= ERB::Util.html_escape("#{@title} — Albumen") %>">
<% if @desc %><meta property="og:description" content="<%= ERB::Util.html_escape(@desc) %>"><% end %>
- <meta property="og:image" content="<%= og_image_url || "#{request.base_url}/img/albumen.png" %>">
+ <meta property="og:image" content="<%= og_image_url || "#{request.base_url}/img/og-default.png" %>">
+ <meta property="og:image:width" content="1200">
+ <meta property="og:image:height" content="630">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="stylesheet" href="/css/style.css?v=2">