我如何区分 Apache Tomcat 提供 404 和我在 tomcat 上返回 404 的应用程序?

How do I differentiate between Apache Tomcat serving up a 404 and my application on tomcat returning a 404?

我有一个 Java/Spring 应用程序,我正在使用 Spring 的 Rest 模板来调用托管在 apache tomcat 容器上的网络服务,我想知道我如何区分提供 404 页面的 tomcat 容器(例如,当应用程序未部署时)和我的网络服务 returns 404(比如当我找不到 account/resource ).我是否被迫查看有效负载并找出返回的 "Apache Tomcat" html 字符串?或者有更好的方法来区分这些吗? (即 tomcat 服务器上的一个设置公开了一个 header 值,可能会告诉我这是一个特定于应用程序容器的错误?)

下面列出了我们使用的版本。

提前致谢,

胡安

Header 可能有助于区分两者。

tomcat 回应 http://localhost:8080/asd
Content-Length: 0

HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Sat, 28 Apr 2018 00:32:57 GMT

管理器应用对 http://localhost:8080/manager/htmll
的响应 Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1534

HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1534
Date: Sat, 28 Apr 2018 00:39:10 GMT