存储 URL 的应用程序是否应该首先跟随它们并在任何 301 永久重定向之后存储结果?

Should applications that store URLs first follow them and store the result after any 301 permanent redirects?

我有一个使用 rss 提要的应用程序(尽管可以是任何东西)。用户提供这些提要 urls,他们通常会得到 301 永久重定向。从最佳实践的角度来看,我应该存储原始 url 还是新的 url?

我认为后者更合适,因为这是 301 重定向(以及 308)的目的,这也是爬虫所做的?

我读到规范说要采用新位置 -- 301 Moved Permanently

Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible.

广泛的浏览器行为 () 是无限期地使用新的 URI:

Chrome and Firefox will cache a 301 redirect with no expiry date.

虽然您要求的是一般性答案(“最佳实践观点”),但有理由保留原来的 URL(例如,避免破坏配置不当的强制门户).

与 HTTP 一样,尽可能遵循规范,而不会在实践中造成糟糕的用户体验。