大网数据广告活动
网站运营与故障问答

What is the proper metadata to set on temporary 500 errors?

· 52CE 我爱测

Context I am building a web application with server side rendering on top of a headless CMS. Sometimes the CMS is down and the frontend has no idea what to display to the user, other than showing a generic error page. I am settin…

问题原文

原帖链接 · Tmarty · CC BY-SA 4.0

Context

I am building a web application with server side rendering on top of a headless CMS. Sometimes the CMS is down and the frontend has no idea what to display to the user, other than showing a generic error page. I am setting the HTTP status code to 500 and wondering what the proper metadata is to set in these cases.

Goals

  • The page should not be removed from the index
  • If possible, crawlers should not update their index of the page with the error page content

Possible actions

HTTP status codes

Sending 500 Internal Server Error or 503 Service Unavailable as appropriate seems like a good idea and hopefully causes the crawlers to not update the index and try again after some time.

noIndex

When Googlebot next crawls that page and sees the tag or header, Googlebot will drop that page entirely from Google Search results, regardless of whether other sites link to it.

Seems not to fit this case since the error is temporary, so I am not going to do this.

title

Seems like a good idea to set to something like Something went wrong | Sitename for the users as it shows up in their tab etc. I just hope the crawlers don't update the index to it. If this value does end up in the index even if the HTTP status code was 500 or 503, I would put Path | Sitename or something similar.

Meta description

Depending on the above I would put either what I am going to show to the user, or something more specific that would fit better in the search result such as There was a temporary error during the last indexing of this page.

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

For SEO, the title and the meta tags of a 5xx page don't matter. Search engines bots see the HTTP status code and base their decisions only on that. They will ignore titles, meta descriptions, and noindex.

For the most part, search engines do what you want. They never index content from the error page itself. For most error statuses, they retry the request again later and give a grace period (usually 24 hours) before removing pages from the index.

There are some differences between the various error codes:

  • 500 Internal Server Error is the appropriate error to show when the code powering the page fails due to an exception or error. It indicates that there is supposed to be content at that URL, but something went wrong. It may or may not be an intermittent error. There is no promise as to when it will be fixed.

  • 503 Service Unavailable is the appropriate error to show when the site is down for maintenance. Typically the entire site (or a large section of the site) will show this error all at once. Ideally the message along with it will say how long the outage is expected to last. For bots you can put that information into the Retry-After HTTP header. See HTTP headers | Retry-After - GeeksforGeeks

  • 404 Not Found is the appropriate error to show when the CMS does not have a rule for what content should be at that URL.

  • 410 Gone is the appropriate error to show when content has been removed from a URL. This is the one error status to which Google does not give a grace period, and removes the URL from its index right away.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-02-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。