使用Facebook分享调试工具检测域名遇302及OG属性缺失问题
Let's break down how to fix this problem step by step—since the 302 redirect and "missing OG tags" warning are almost certainly connected:
1. Resolve the 302 Redirect First
A 302 status means Facebook's crawler is being sent away from the URL you're testing, which is likely why it's not picking up your OG tags. Here's what to check:
- Audit your redirect rules: If your site uses
.htaccess(Apache), Nginx config, or a CMS redirect plugin, verify if the HTTP version of your domain is redirecting to HTTPS (or another page). Try testing the HTTPS version of your domain directly in the debugger if you have it set up. - Avoid chained redirects: Steer clear of multiple hops (e.g., HTTP → HTTPS → a different page) as this can confuse the crawler. Ensure the final destination URL is the one you intend to share, with all OG tags intact.
2. Confirm OG Tags Are Served to Facebook's Crawler
Sometimes browsers show OG tags, but servers return different content to crawlers. To verify:
- Use the
curlcommand to simulate Facebook's user agent:curl -A "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)" http://duniakulinerbandung.com - Scan the returned HTML source for your OG tags (like
<meta property="og:image" content="...">). If they don't appear here, your server is blocking or modifying content for Facebook's crawler—check your CMS settings, caching plugins, or security tools that filter by user agent.
3. Fix Subtle OG Tag Issues (Even If You Think They're Correct)
The debugger's warnings often point to easy-to-miss problems:
- og:url: Must be an absolute, canonical URL matching the page being shared (e.g.,
https://duniakulinerbandung.comnot just/). This tells Facebook exactly which URL to associate with your content. - og:image: Use an absolute URL (not relative like
/images/hero.jpg), ensure the image is publicly accessible (no hotlink protection blocking Facebook), and meets Facebook's minimum size requirement (1200x630 pixels). Test the image URL directly in a browser to confirm it loads. - og:type: Set this to a valid value (e.g.,
websitefor your homepage,articlefor blog posts). - fb:app_id: Create a basic Facebook App (it doesn't need to be public) to get an app ID, then add the tag
<meta property="fb:app_id" content="YOUR_APP_ID">—this is required for full sharing functionality.
4. Clear Facebook's Cache
The Debugger caches previous scrape results, so even if you fixed issues, it might show outdated data:
- After making changes, go back to the Facebook Sharing Debugger, enter your URL, and click the Scrape Again button at the top of the results page. This forces the crawler to re-fetch your page.
5. Rule Out Server/CMS Blocking
- Firewall/CDN: Ensure your firewall or CDN isn't blocking Facebook's crawler IP ranges. Most CDNs have pre-configured rules to allow social media crawlers, but double-check your settings.
- CMS Plugins: If you're using a CMS like WordPress, SEO or security plugins might be overriding your OG tags. Temporarily disable these plugins and re-scrape to see if the tags appear.
内容的提问来源于stack exchange,提问作者Yudi Yohanes Septian Gotama
相关产品推荐
相关产品推荐

