gpt4 book ai didi

apache - 具有 SNI(服务器名称指示)的 RESTful、面向 Web 的服务

转载 作者:太空宇宙 更新时间:2023-11-03 12:49:57 24 4
gpt4 key购买 nike

我有一个 Spring MVC 应用程序,它通过 HTTP POST 方法从另一个应用程序接收 URL 回调,该方法还将发送 SNI((服务器名称指示)用于 SSL/TLS 连接),因此我必须实现一个 RESTful 面向 Web 的应用程序我的 Spring 应用程序中的服务。因为我将始终从同一台服务器接收 URL CallBack,所以我想拒绝来自其他服务器的所有请求。在哪里更好地检查服务器名称?在 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 应用程序位于 apache 网络服务器之后,充当 gateway (a.k.a. reverse proxy) ,您可以使用以下 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.

关于apache - 具有 SNI(服务器名称指示)的 RESTful、面向 Web 的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40862086/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com