RESTful,带有 SNI(服务器名称指示)的面向 Web 的服务

RESTful, web-facing service with SNI (Server Name Indication)

我有一个 Spring MVC 应用程序,它通过 HTTP POST 方法从另一个应用程序接收 URL 回调,该方法也将为 SSL/TLS 连接),所以我必须在我的 Spring 应用程序中实现一个 RESTful 面向网络的服务。 因为我总是会从同一台服务器收到 URL 回调,所以我想拒绝来自其他服务器的所有请求。在哪里更好地检查服务器名称?在 Spring MVC 应用程序级别或者有一种方法可以配置 Apache Web 服务器 ??

我有一个接受 POST 请求的 @Controller 端点,就像这样 http://myserver/MyApp/api/registerUser?userId=E506&lat=41&lng=7&rssi=-127&data=3428102231

但是这个请求总是来自服务器 111.222.333.444,所以我只想接受来自该服务器的请求而不是其他任何人(比如说潜在的黑客)

如果您的 Spring 应用程序位于作为 gateway (a.k.a. reverse proxy) 的 apache 网络服务器之后,您可以使用以下 apache 配置来限制访问:

<Location "/url/of/the/webservice">
    Require ip 111.222.333.444
</Location>

来自文档:

The <Location> directive limits the scope of the enclosed directives by URL.

This Require directive tests whether an authenticated user is authorized according to a particular authorization provider and the specified restrictions.